Package org.chocosolver.solver.learn
Class EventRecorder
- java.lang.Object
-
- org.chocosolver.solver.learn.AbstractEventObserver
-
- org.chocosolver.solver.learn.EventRecorder
-
public class EventRecorder extends AbstractEventObserver
An explanation engine that learns general constraint from failures.Project: choco-solver.
- Since:
- 25/01/2017.
- Author:
- Charles Prud'homme
-
-
Field Summary
-
Fields inherited from class org.chocosolver.solver.learn.AbstractEventObserver
SILENT_OBSERVER
-
-
Constructor Summary
Constructors Constructor Description EventRecorder(Solver solver)
Create an explanation engine which is able to learn general constraint on conflict
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Implications>
getGI()
void
instantiateTo(IntVar var, int val, ICause cause, int oldLB, int oldUB)
Explain the assignment toval
ofvar
due tocause
.void
removeValue(IntVar var, int val, ICause cause)
Explain the removal of theval
fromvar
, due tocause
.void
undo()
Undo the last operation donevoid
updateLowerBound(IntVar var, int value, int old, ICause cause)
Explain the removal of [old
,value
[ fromvar
, due tocause
.void
updateUpperBound(IntVar var, int value, int old, ICause cause)
Explain the removal of ]value
,old
] fromvar
, due tocause
.
-
-
-
Constructor Detail
-
EventRecorder
public EventRecorder(Solver solver)
Create an explanation engine which is able to learn general constraint on conflict- Parameters:
solver
- solver this class relies on
-
-
Method Detail
-
removeValue
public void removeValue(IntVar var, int val, ICause cause)
Explain the removal of theval
fromvar
, due tocause
. This is the main explanation why we create this class. Record operations to execute for explicit call to explanation.- Overrides:
removeValue
in classAbstractEventObserver
- Parameters:
var
- an integer variableval
- a valuecause
- a cause
-
updateLowerBound
public void updateLowerBound(IntVar var, int value, int old, ICause cause)
Explain the removal of [old
,value
[ fromvar
, due tocause
. Prerequisite:value
should belong tovar
This is the main reason why we create this class. Record operations to execute for explicit call to explanation.- Overrides:
updateLowerBound
in classAbstractEventObserver
- Parameters:
var
- an integer variablevalue
- a valuecause
- a cause
-
updateUpperBound
public void updateUpperBound(IntVar var, int value, int old, ICause cause)
Explain the removal of ]value
,old
] fromvar
, due tocause
. Prerequisite:value
should belong tovar
This is the main reason why we create this class. Record operations to execute for explicit call to explanation.- Overrides:
updateUpperBound
in classAbstractEventObserver
- Parameters:
var
- an integer variablevalue
- a valuecause
- a cause
-
instantiateTo
public void instantiateTo(IntVar var, int val, ICause cause, int oldLB, int oldUB)
Explain the assignment toval
ofvar
due tocause
. This is the main reason why we create this class. Record operations to execute for explicit call to explanation.- Overrides:
instantiateTo
in classAbstractEventObserver
- Parameters:
var
- an integer variableval
- a valuecause
- a causeoldLB
- previous lboldUB
- previous ub
-
getGI
public Optional<Implications> getGI()
- Overrides:
getGI
in classAbstractEventObserver
-
undo
public void undo()
Description copied from class:AbstractEventObserver
Undo the last operation done- Overrides:
undo
in classAbstractEventObserver
-
-