Modifier and Type | Field and Description |
---|---|
protected int[] |
bestSolution
Last solution found, wrt
vars |
protected BitSet |
fragment
Indicate which variables are selected to be part of the fragment
|
protected int |
level
Relaxing factor
|
protected int |
limit
Next time the level should be increased
|
protected Model |
mModel
Reference to the model
|
protected int |
n
Number of variables to consider in this neighbor
|
protected int |
nbCall
Number of times this neighbor is called
|
protected IntVar[] |
vars
Variables to consider in this neighbor
|
Constructor and Description |
---|
RandomNeighborhood(IntVar[] vars,
int level,
long seed)
Create a neighbor for LNS which randomly selects variable to be part of a fragment
|
Modifier and Type | Method and Description |
---|---|
void |
fixSomeVariables(DecisionPath decisionPath)
Freezes some variables in order to have a fast computation.
|
protected void |
impose(int id,
DecisionPath decisionPath)
Impose a decision to be part of the fragment
|
void |
init()
Initialize this neighbor
|
boolean |
isSearchComplete() |
void |
loadFromSolution(Solution solution)
Load a solution and record it
|
void |
recordSolution()
Record values of decision variables to freeze some ones during the next LNS run
|
void |
restrictLess()
Use less restriction at the beginning of a LNS run
in order to get better solutions
Called when no solution was found during a LNS run (trapped into a local optimum)
|
protected int |
selectVariable() |
protected final int n
protected final IntVar[] vars
protected final int[] bestSolution
vars
protected int nbCall
protected int limit
protected final int level
protected BitSet fragment
protected Model mModel
public RandomNeighborhood(IntVar[] vars, int level, long seed)
vars
- variables to consider in thislevel
- relaxing factorseed
- for randomnesspublic void init()
INeighbor
public boolean isSearchComplete()
isSearchComplete
in interface INeighbor
public void recordSolution()
INeighbor
recordSolution
in interface INeighbor
public void loadFromSolution(Solution solution)
INeighbor
loadFromSolution
in interface INeighbor
solution
- a solution to recordpublic void fixSomeVariables(DecisionPath decisionPath)
INeighbor
fixSomeVariables
in interface INeighbor
decisionPath
- the decision path in which declaring variable to freezeprotected void impose(int id, DecisionPath decisionPath)
id
- variable id in vars
decisionPath
- the current decision pathprotected int selectVariable()
vars
to be part of the fragmentpublic void restrictLess()
INeighbor
restrictLess
in interface INeighbor
Copyright © 2018. All rights reserved.