at.tuwien.ifs.somtoolbox.apps.viewer.controls
Class AutoRoutePanel.SimpleTSPSolver.Tour

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.apps.viewer.controls.AutoRoutePanel.SimpleTSPSolver.Tour
Enclosing class:
AutoRoutePanel.SimpleTSPSolver

 class AutoRoutePanel.SimpleTSPSolver.Tour
extends Object

A path in a graph. From[i] is the index of the point leading to i. To[i] the index of the point after i. The path can optimize itself in a graph.


Field Summary
 int[] from
           
(package private)  AutoRoutePanel.SimpleTSPSolver.Graph g
           
(package private)  double l
           
(package private)  int n
           
 int[] to
           
 
Constructor Summary
AutoRoutePanel.SimpleTSPSolver.Tour(AutoRoutePanel.SimpleTSPSolver.Graph g)
           
 
Method Summary
 Object clone()
           
(package private)  void getlength()
          compute the length of the path
 boolean improve()
          try to find another path with shorter length using removals of points j and inserting i,j,i+1
 boolean improvecross()
          improve the path locally, using replacements of i,i+1 and j,j+1 with i,j and i+1,j+1
 double length()
          The length of this route.
(package private)  void localoptimize()
          find a local optimum starting from this path
 void random(Random r)
          Create a random route.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

g

AutoRoutePanel.SimpleTSPSolver.Graph g

n

int n

l

double l

from

public int[] from

to

public int[] to
Constructor Detail

AutoRoutePanel.SimpleTSPSolver.Tour

public AutoRoutePanel.SimpleTSPSolver.Tour(AutoRoutePanel.SimpleTSPSolver.Graph g)
Method Detail

clone

public Object clone()
Overrides:
clone in class Object

random

public void random(Random r)
Create a random route. random path.


length

public double length()
The length of this route.

Returns:
The length

improve

public boolean improve()
try to find another path with shorter length using removals of points j and inserting i,j,i+1

Returns:
true if an improvement has been found, false otherwise.

improvecross

public boolean improvecross()
improve the path locally, using replacements of i,i+1 and j,j+1 with i,j and i+1,j+1

Returns:
true if an improvement has been found, false otherwise.

getlength

void getlength()
compute the length of the path


localoptimize

void localoptimize()
find a local optimum starting from this path