public static class EBRP.EBRPSolution
extends java.lang.Object
addVisit(int)
You can also add the whole ordering in one go setVisitOrder(int[])
Do not add the first nor the last stop to the depot, it is implicit
You can check the validity of your solution with compute()
, which returns the total distance
and throws a RuntimeException
if something is invalid or isValid()
, which only tells
if the solution is valid or not
DO NOT MODIFY THIS CLASS.
Constructor and Description |
---|
EBRPSolution(EBRP.EBRPInstance instance)
create a solution to a EBRP instance
the visit order is added through
addVisit(int)
or setVisitOrder(int[]) |
Modifier and Type | Method and Description |
---|---|
void |
addVisit(int node)
set the last visited node in the current travel
|
void |
clear()
clear the solution, forgetting the order of visit that was given previously
|
int |
compute()
compute the value of the solution
throws a
RuntimeException if the solution is invalid |
boolean |
isValid()
tell if the solution is valid or not
|
void |
setVisitOrder(int[] ordering)
set the order of visits of nodes
|
java.lang.String |
toString()
output the solution on two lines: its length (objective value) and its ordering
|
public EBRPSolution(EBRP.EBRPInstance instance)
addVisit(int)
or setVisitOrder(int[])
instance
- instance whose solution will be representedpublic java.lang.String toString()
toString
in class java.lang.Object
public void addVisit(int node)
node
- last node being visited (do not include the depot)public void setVisitOrder(int[] ordering)
ordering
- order of nodes, not containing the depotpublic int compute()
RuntimeException
if the solution is invalidpublic boolean isValid()
public void clear()