SparkseeNet  6.0.2
Public Member Functions | List of all members
com.sparsity.sparksee.algorithms.KOpt Class Reference

KOpt class. More...

Public Member Functions

 KOpt (com.sparsity.sparksee.gdb.Session session, com.sparsity.sparksee.gdb.OIDList tour)
 Creates a new instance.
 
void AddNodeType (int type) throws System.ApplicationException
 Allows for traversing nodes of the given type.
 
com.sparsity.sparksee.gdb.OIDList GetCurrentTour ()
 Returns tour as a list of nodes.
 
 KOpt (com.sparsity.sparksee.gdb.Session session)
 Creates a new instance.
 
void SetTimeLimit (long maxTime)
 Limits execution time.
 
void RunTwoOpt ()
 Runs 2-Opt local search.
 
void AddAllEdgeTypes (com.sparsity.sparksee.gdb.EdgesDirection dir)
 Allows for traversing all edge types of the graph.
 
void RunThreeOpt ()
 Runs 3-Opt local search.
 
boolean IsClosed ()
 Gets if KOpt instance has been closed or not.
 
void AddAllNodeTypes ()
 Allows for traversing all node types of the graph.
 
void SetCurrentTour (com.sparsity.sparksee.gdb.OIDList tour)
 Sets current tour as a list of nodes.
 
void Close ()
 Closes the KOpt instance.
 
void AddEdgeType (int type, com.sparsity.sparksee.gdb.EdgesDirection dir) throws System.ApplicationException
 Allows for traversing edges of the given type.
 
void SetEdgeWeightAttributeType (int attr) throws System.ApplicationException
 Sets the attribute to use as edge weight.
 
void SetMaxIterations (long maxIterations)
 Sets maximum number of iterations.
 
double GetCurrentCost ()
 Returns tour cost.
 

Detailed Description

KOpt class.

Implements the 2-Opt and 3-Opt algorithms

Author
Sparsity Technologies http://www.sparsity-technologies.com

Constructor & Destructor Documentation

com.sparsity.sparksee.algorithms.KOpt.KOpt ( com.sparsity.sparksee.gdb.Session  session,
com.sparsity.sparksee.gdb.OIDList  tour 
)

Creates a new instance.

Parameters
session[in] Session to get the graph from and perform algorithm.
tour[in] Initial tour that needs to be improved.
com.sparsity.sparksee.algorithms.KOpt.KOpt ( com.sparsity.sparksee.gdb.Session  session)

Creates a new instance.

Parameters
session[in] Session to get the graph from and perform algorithm.

Member Function Documentation

void com.sparsity.sparksee.algorithms.KOpt.AddAllEdgeTypes ( com.sparsity.sparksee.gdb.EdgesDirection  dir)

Allows for traversing all edge types of the graph.

Parameters
dir[in] Edge direction.
void com.sparsity.sparksee.algorithms.KOpt.AddEdgeType ( int  type,
com.sparsity.sparksee.gdb.EdgesDirection  dir 
) throws System.ApplicationException

Allows for traversing edges of the given type.

If the edge type was already added, the existing direction is overwritten

Parameters
type[in] Edge type.
dir[in] Edge direction.
Exceptions
System.ApplicationExceptionnull
void com.sparsity.sparksee.algorithms.KOpt.AddNodeType ( int  type) throws System.ApplicationException

Allows for traversing nodes of the given type.

sparksee::gdb::Error

Parameters
type[in] Node type.
Exceptions
System.ApplicationExceptionnull
void com.sparsity.sparksee.algorithms.KOpt.Close ( )

Closes the KOpt instance.

It must be called to ensure the integrity of all data.

boolean com.sparsity.sparksee.algorithms.KOpt.IsClosed ( )

Gets if KOpt instance has been closed or not.

See Also
Close()
Returns
TRUE if the KOpt instance has been closed, FALSE otherwise.
void com.sparsity.sparksee.algorithms.KOpt.SetCurrentTour ( com.sparsity.sparksee.gdb.OIDList  tour)

Sets current tour as a list of nodes.

Parameters
tour[in] Initial tour that needs to be improved.
void com.sparsity.sparksee.algorithms.KOpt.SetEdgeWeightAttributeType ( int  attr) throws System.ApplicationException

Sets the attribute to use as edge weight.

If the multiple edge are set for traversal, this attribute must be of type GLOBAL_TYPE or EDGES_TYPE. Additionally, the attribute must be of type Double.

sparksee::gdb::Error

Parameters
attr[in] The attribute type to use as a weight. Default: InvalidAttribute
Exceptions
System.ApplicationExceptionnull
void com.sparsity.sparksee.algorithms.KOpt.SetMaxIterations ( long  maxIterations)

Sets maximum number of iterations.

By default the algorithm will run until no improvement can be made in the current tour.

Parameters
maxIterations[in] Maximum number of iterations
void com.sparsity.sparksee.algorithms.KOpt.SetTimeLimit ( long  maxTime)

Limits execution time.

Parameters
maxTime[in] Time limit in miliseconds