Modifier and Type | Field and Description |
---|---|
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 int |
n
Number of 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()
Freezes some variables in order to have a fast computation.
|
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)
|
forEachIntVar, freeze, init, isSearchComplete
protected final int n
protected int limit
protected final int level
protected BitSet fragment
public RandomNeighborhood(IntVar[] vars, int level, long seed)
vars
- variables to consider in thislevel
- relaxing factorseed
- for randomnesspublic void recordSolution()
Neighbor
recordSolution
in class Neighbor
public void loadFromSolution(Solution solution)
Neighbor
loadFromSolution
in class Neighbor
solution
- a solution to recordpublic void fixSomeVariables() throws ContradictionException
Neighbor
fixSomeVariables
in class Neighbor
ContradictionException
public void restrictLess()
Neighbor
restrictLess
in class Neighbor
Copyright © 2018. All rights reserved.