public class ExplainingCut extends Object implements INeighbor
This neighborhood is specific in the sense that it needs to compute explanation after a new solution has been found.
Furthermore, the fixSomeVariables method creates and applies decisions, so that the explanation recorder can infer.
It works as follow:
- on a solution: force the application of the cut together with the decision path which leads to the solution, explain the failure
- then, on a call to fixSomeVariables, it selects randomly K decisions explaining the cut, and relax them from the decision path.
Unrelated decisions are never relaxed, the idea here is to work only on the decisions which lead to a failure.
TODO: fix some variables TODO: catch up case when the sub tree is closed and this imposes a fragment
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
forceCft
Indicates if the cut has already been explained
|
protected List<IntDecision> |
mDecisionPath
A copy of the decision path which led to the solution
|
protected IExplanationEngine |
mExplanationEngine
The explanation engine that computes explanation on solution
|
protected Model |
mModel
Reference to the model
|
protected int |
nbCall
Number of times this neighbor is called
|
protected double |
nbFixedVariables
Number of decisions to fix in the fragment
|
protected BitSet |
notFrozen
Indicates which decisions are frozen in the current fragment
|
protected Random |
random
For randomness purpose
|
protected BitSet |
related
Indicates which decisions are related to the explanation in
mDecisionPath |
protected BitSet |
unrelated
Indicates which decisions are not related to the explanation in
mDecisionPath |
| Constructor and Description |
|---|
ExplainingCut(Model aModel,
int level,
long seed)
Create a neighborhood which analyses the explanation of the cut wrt decision path to focus on decisions
more prone to not interact with the cut
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
_fixVar()
Regarding the explanation, pick decisions to create a fragment
|
protected void |
clonePath()
Compute the initial fragment, ie set of decisions to keep.
|
protected void |
explain()
Force the failure, apply decisions to the last solution + cut => failure!
|
void |
fixSomeVariables(DecisionPath decisionPath)
Freezes some variables in order to have a fast computation.
|
protected void |
increaseLimit()
Increase the relaxing limit
|
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 IExplanationEngine mExplanationEngine
protected final Random random
protected List<IntDecision> mDecisionPath
protected BitSet related
mDecisionPathprotected BitSet unrelated
mDecisionPathprotected BitSet notFrozen
protected boolean forceCft
protected double nbFixedVariables
protected int nbCall
protected Model mModel
public ExplainingCut(Model aModel, int level, long seed)
aModel - the modellevel - the relaxing factorseed - a seed for randomnesspublic void init()
INeighborpublic void recordSolution()
INeighborrecordSolution in interface INeighborpublic void loadFromSolution(Solution solution)
INeighborloadFromSolution in interface INeighborsolution - a solution to recordpublic void fixSomeVariables(DecisionPath decisionPath)
INeighborfixSomeVariables in interface INeighbordecisionPath - the decision path in which declaring variable to freezeprotected void _fixVar()
public void restrictLess()
INeighborrestrictLess in interface INeighborpublic boolean isSearchComplete()
isSearchComplete in interface INeighborprotected void increaseLimit()
protected void clonePath()
protected void explain()
Copyright © 2017. All rights reserved.