|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsavi.alg.tsp.StateTSP
public class StateTSP
State representing TSP problem
Field Summary | |
---|---|
protected Cities |
cities
reference to list of cities |
protected double |
cost
current cost (length of tour) |
protected int[] |
path
current path |
protected java.util.Random |
rnd
instance to random generator |
Constructor Summary | |
---|---|
StateTSP(Cities cities)
Creates a new instance of StateTSP, initialize cities |
Method Summary | |
---|---|
java.lang.Object |
clone()
Create a copy of this object. |
void |
findInitialState(double temp)
Find initial state. |
void |
findNextState(double temp)
Find next state. |
double |
getActualCost()
Return current optimalization criterion value. |
Cities |
getCities()
Return list of cities |
int[] |
getPath()
Return path sequence |
java.lang.String[] |
getSubmission()
Return text representation of TSP instance. |
double |
recountCost()
Recalculate path length. |
protected void |
reversePath(int[] array,
int start,
int end)
Reverse path between two cities in given city list |
void |
setCities(Cities c)
Set list of cities |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Cities cities
protected double cost
protected int[] path
protected java.util.Random rnd
Constructor Detail |
---|
public StateTSP(Cities cities)
cities
- cities listMethod Detail |
---|
protected void reversePath(int[] array, int start, int end)
array
- city liststart
- starting indexend
- final indexpublic void findInitialState(double temp)
findInitialState
in interface StateSkeleton
temp
- starting temp¨public void findNextState(double temp)
findNextState
in interface StateSkeleton
temp
- current temperaturepublic double getActualCost()
getActualCost
in interface StateSkeleton
public java.lang.Object clone()
clone
in interface StateSkeleton
clone
in class java.lang.Object
public double recountCost()
public int[] getPath()
public Cities getCities()
public void setCities(Cities c)
c
- cities listpublic java.lang.String[] getSubmission()
getSubmission
in interface StateSkeleton
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |