TspTwProblem

org.ddolibscala.example.tsptw.TspTwProblem
See theTspTwProblem companion object
class TspTwProblem(numNodes: Int, val timeMatrix: Int => Int => Int, val timeWindows: Array[TimeWindow], _optimal: Option[Double] = ..., name: Option[String] = ...) extends Problem[TspTwState]

Class representing an instance of the Traveling Salesperson Problem with Time Windows (TSPTW).

Each node has a time window during which it must be visited, and travel between nodes is defined by a distance matrix. This class implements the org.ddolibscala.modeling.Problem trait for use in decision diagram solvers.

The problem instance can optionally provide the known optimal solution.

Value parameters

_optimal

if known, the optimal solution of this problem. Useful for tests

name

an optional name to override the default toString

numNodes

the number of nodes to route (including the start point)

timeMatrix

function such that timeMatrix(i)(j) returns the travel time between node i and node j

timeWindows

for each node, contains the associated time window

Attributes

Companion
object
Graph
Supertypes
trait Problem[TspTwState]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def domainValues(state: TspTwState, variable: Int): Iterable[Int]

Returns the domain of possible values for a given variable when applied to a specific state.

Returns the domain of possible values for a given variable when applied to a specific state.

Value parameters

state

the current state

variable

the variable index whose domain is queried

Attributes

Returns

ll feasible values for the variable in this state

Definition Classes
override def evaluate(solution: Array[Int]): Double

Given a solution such that solution(i) is the value of the variablex_i, returns the value of this solution and checks if the solution respects the problem's constraints.

Given a solution such that solution(i) is the value of the variablex_i, returns the value of this solution and checks if the solution respects the problem's constraints.

Value parameters

solution

A solution of the problem.

Attributes

Returns

The value of the input solution.

Note

For maximization problems, the returned value is minus the computed value.

Definition Classes
Problem -> Problem
override def initialState(): TspTwState

Returns the initial state of the problem.

Returns the initial state of the problem.

Attributes

Returns

the state representing the starting point of the optimization

Definition Classes
Problem -> Problem
override def initialValue(): Double

Returns the initial objective value associated with the initial state.

Returns the initial objective value associated with the initial state.

Attributes

Returns

the starting value of the objective function

Definition Classes
Problem -> Problem
override def nbVars(): Int

Returns the total number of decision variables in this problem.

Returns the total number of decision variables in this problem.

Attributes

Returns

the total number of decision variables in this problem

Definition Classes
Problem -> Problem
override def optimal: Option[Double]

Returns the optimal value of the problem if known

Returns the optimal value of the problem if known

Attributes

Returns

the optimal value of the problem if known

Definition Classes
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
override def transition(state: TspTwState, decision: Decision): TspTwState

Applies a decision to a state, computing the next state according to the problem's transition function.

Applies a decision to a state, computing the next state according to the problem's transition function.

Value parameters

decision

the decision to apply

state

the state from which the transition originates

Attributes

Returns

the resulting state after applying the decision

Definition Classes
Problem -> Problem
override def transitionCost(state: TspTwState, decision: Decision): Double

Computes the change in objective value resulting from applying a decision to a given state.

Computes the change in objective value resulting from applying a decision to a given state.

Value parameters

decision

the decision to apply

state

the state from which the transition originates

Attributes

Returns

the incremental objective cost/value associated with this decision

Definition Classes
Problem -> Problem

Inherited methods

final override def domain(state: TspTwState, variable: Int): Iterator[Integer]

Used by the solver. Converts the input of ouput of domainValues from Java to Scala and vice versa.

Used by the solver. Converts the input of ouput of domainValues from Java to Scala and vice versa.

Attributes

Definition Classes
Problem -> Problem
Inherited from:
Problem
final override def optimalValue(): Optional[Double]

Used by the solver. Converts the input of ouput of optimal from Java to Scala and vice versa.

Used by the solver. Converts the input of ouput of optimal from Java to Scala and vice versa.

Attributes

Definition Classes
Problem -> Problem
Inherited from:
Problem

Concrete fields

val timeMatrix: Int => Int => Int
val timeWindows: Array[TimeWindow]