Package org.chocosolver.solver.trace
Class SearchViz
- java.lang.Object
-
- org.chocosolver.solver.trace.SearchViz
-
- All Implemented Interfaces:
Closeable,AutoCloseable,IMonitorContradiction,IMonitorDownBranch,IMonitorRestart,IMonitorSolution,IMonitorUpBranch,ISearchMonitor
- Direct Known Subclasses:
CPProfiler,GephiGenerator,GraphvizGenerator
public abstract class SearchViz extends Object implements IMonitorDownBranch, IMonitorUpBranch, IMonitorSolution, IMonitorContradiction, IMonitorRestart, Closeable
Created by cprudhom on 22/10/2015. Project: choco.- Since:
- 3.3.2
- Author:
- Charles Prud'homme
-
-
Constructor Summary
Constructors Constructor Description SearchViz(Solver aSolver, boolean sendDomain)Active connection to cp-profiler.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidafterRestart()Actions to execute after restarting the searchvoidbeforeDownBranch(boolean left)Action to perform before going down in the tree searchvoidbeforeUpBranch()Actions to execute before going up in the tree searchvoidclose()Close connection to cp-profiler.protected abstract booleanconnect(String label)protected abstract voiddisconnect()voidonContradiction(ContradictionException cex)voidonSolution()protected abstract voidsendFailure(int nc, int pid, int alt, int kid, int rid, String label, String info)protected abstract voidsendNode(int nc, int pid, int alt, int kid, int rid, String label, String info)protected abstract voidsendRestart(int rid)protected abstract voidsendSolution(int nc, int pid, int alt, int kid, int rid, String label, String info)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.chocosolver.solver.search.loop.monitors.IMonitorDownBranch
afterDownBranch
-
Methods inherited from interface org.chocosolver.solver.search.loop.monitors.IMonitorRestart
beforeRestart
-
Methods inherited from interface org.chocosolver.solver.search.loop.monitors.IMonitorUpBranch
afterUpBranch
-
-
-
-
Field Detail
-
mSolver
protected Solver mSolver
Reference to the model
-
connected
protected boolean connected
Is connection alive
-
-
Constructor Detail
-
SearchViz
public SearchViz(Solver aSolver, boolean sendDomain)
Active connection to cp-profiler. This requires cp-profiler to be installed and launched before.- Parameters:
aSolver- solver to observe resolutionsendDomain- set to true to send domain into 'info' field (beware, it can increase the memory consumption and slow down the overall execution), set to false otherwise.
-
-
Method Detail
-
connect
protected abstract boolean connect(String label)
-
disconnect
protected abstract void disconnect()
-
sendNode
protected abstract void sendNode(int nc, int pid, int alt, int kid, int rid, String label, String info)
-
sendSolution
protected abstract void sendSolution(int nc, int pid, int alt, int kid, int rid, String label, String info)
-
sendFailure
protected abstract void sendFailure(int nc, int pid, int alt, int kid, int rid, String label, String info)
-
sendRestart
protected abstract void sendRestart(int rid)
-
close
public final void close() throws IOExceptionClose connection to cp-profiler.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
beforeDownBranch
public final void beforeDownBranch(boolean left)
Description copied from interface:IMonitorDownBranchAction to perform before going down in the tree search- Specified by:
beforeDownBranchin interfaceIMonitorDownBranch- Parameters:
left- set to true to specify that this is a left branch
-
beforeUpBranch
public final void beforeUpBranch()
Description copied from interface:IMonitorUpBranchActions to execute before going up in the tree search- Specified by:
beforeUpBranchin interfaceIMonitorUpBranch
-
onSolution
public final void onSolution()
- Specified by:
onSolutionin interfaceIMonitorSolution
-
onContradiction
public final void onContradiction(ContradictionException cex)
- Specified by:
onContradictionin interfaceIMonitorContradiction
-
afterRestart
public final void afterRestart()
Description copied from interface:IMonitorRestartActions to execute after restarting the search- Specified by:
afterRestartin interfaceIMonitorRestart
-
-