public class PropagationGuidedNeighborhood extends Object implements INeighbor
Based on "Propagation Guided Large Neighborhood Search", Perron et al. CP2004.
Modifier and Type | Field and Description |
---|---|
protected int[] |
all
Store the modified variables
|
protected int[] |
bestSolution
Last solution found, wrt
vars |
protected List<Integer> |
candidates
Store the variable elligible for propagation
|
protected int[] |
dsize
Domain size of each variable in
vars |
protected double |
epsilon
Restriction parameter
|
protected int |
fgmtSize
Intial size of the fragment
|
protected BitSet |
fragment
Indicate which variables are selected in a fragment
|
protected int |
listSize
Number of variables modified through propagation to consider while computing the neighbor
|
protected double |
logSum
Logarithmic cardinality of domains
|
protected Model |
mModel
Reference to the model
|
protected int |
n
Number of variables
|
protected Random |
rd
For randomness
|
protected IntVar[] |
vars
Array of variables to consider in a fragment
|
Constructor and Description |
---|
PropagationGuidedNeighborhood(IntVar[] vars,
int fgmtSize,
int listSize,
long seed)
Create a propagation-guided neighbor for LNS
|
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 void |
update(DecisionPath decisionPath)
Create the fragment
|
protected final int n
protected final IntVar[] vars
protected final int[] bestSolution
vars
protected int[] dsize
vars
protected Random rd
protected int fgmtSize
protected int listSize
protected double epsilon
protected double logSum
protected int[] all
protected BitSet fragment
protected Model mModel
public PropagationGuidedNeighborhood(IntVar[] vars, int fgmtSize, int listSize, long seed)
vars
- set of variables to considerfgmtSize
- initial size of the fragmentlistSize
- number of modified variable to store while propagatingseed
- for randomnesspublic 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 update(DecisionPath decisionPath) throws ContradictionException
decisionPath
- the decision path to feedContradictionException
- if the fragment is trivially infeasibleprotected void impose(int id, DecisionPath decisionPath) throws ContradictionException
id
- variable id in vars
decisionPath
- the current decision pathContradictionException
- if the application of the decision failsprotected int selectVariable()
vars
to be part of the fragmentpublic void restrictLess()
INeighbor
restrictLess
in interface INeighbor
Copyright © 2018. All rights reserved.