TspTwRelax

org.ddolibscala.example.tsptw.TspTwRelax
class TspTwRelax(numVar: Int) extends Relaxation[TspTwState]

Relaxation class for the Traveling Salesman Problem with Time Windows (TSPTW).

This class implements the org.ddolibscala.modeling.Relaxation interface for TspTwState. It provides methods to merge multiple states into a relaxed state and to relax the cost of transitions (edges) between states.

Value parameters

numVar

number of variables/nodes in the associated TSPTW problem

Attributes

Graph
Supertypes
trait Relaxation[TspTwState]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def merge(statesToMerge: Iterable[TspTwState]): TspTwState

Merges multiple TSPTW states into a single relaxed state.

Merges multiple TSPTW states into a single relaxed state.

The merge operation consists of:

  • Combining visited positions (union of all positions).
  • Computing the intersection of all "must visit" sets
  • Building the "possibly visit" set as the union of all "must visit" and "possibly visit" sets, then removing the nodes that are mandatory
  • Selecting the minimum arrival time among all states.
  • Keeping the depth of the last processed state.

Value parameters

statesToMerge

an iterator over the states to merge

Attributes

Returns

a new TSPTWState representing the relaxed state

Definition Classes
override def relaxEdge(from: TspTwState, to: TspTwState, merged: TspTwState, decision: Decision, cost: Double): Double

Relaxes the cost of an edge (transition) between two states.

Relaxes the cost of an edge (transition) between two states.

In this implementation, the cost is not modified, and the method simply returns the provided value. This method can be extended to apply more sophisticated relaxations if needed.

Value parameters

cost

the cost of the not relaxed arc which used to go from the from state to the to state

decision

the decision which is being challenged

from

the origin of the relaxed arc

merged

the destination of the relaxed arc (after relaxation)

to

the destination of the relaxed arc (before relaxation)

Attributes

Returns

the cost of the relaxed edge

Definition Classes
Relaxation -> Relaxation

Inherited methods

final override def mergeStates(states: Iterator[TspTwState]): TspTwState

Used by the solver. Converts the input and output of merge from Java to Scala and vice versa.

Used by the solver. Converts the input and output of merge from Java to Scala and vice versa.

Attributes

Definition Classes
Relaxation -> Relaxation
Inherited from:
Relaxation