Package org.chocosolver.solver.trace
Class CPProfiler
- java.lang.Object
-
- org.chocosolver.solver.trace.SearchViz
-
- org.chocosolver.solver.trace.CPProfiler
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IMonitorContradiction
,IMonitorDownBranch
,IMonitorRestart
,IMonitorSolution
,IMonitorUpBranch
,ISearchMonitor
public class CPProfiler extends SearchViz
A search monitor to send data to cp-profiler. It enables to profile and to visualize Constraint Programming. An installation is needed and is described here. This monitor relies on its java integration.Note that CPProfiler is
Closeable
and can be used as follow:Model model = ProblemMaker.makeCostasArrays(7); try (CPProfiler profiler = new CPProfiler(model)) { while (model.getSolver().solve()) ; out.println(model.getSolver().getSolutionCount()); }
Created by cprudhom on 22/10/2015. Project: choco.
- Since:
- 3.3.2
- Author:
- Charles Prud'homme
-
-
Constructor Summary
Constructors Constructor Description CPProfiler(Solver aSolver, boolean sendDomain)
Active connection to cp-profiler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
connect(String label)
protected void
disconnect()
protected void
sendFailure(int nc, int pid, int alt, int kid, int rid, String label, String info)
protected void
sendNode(int nc, int pid, int alt, int kid, int rid, String label, String info)
protected void
sendRestart(int rid)
protected void
sendSolution(int nc, int pid, int alt, int kid, int rid, String label, String info)
-
Methods inherited from class org.chocosolver.solver.trace.SearchViz
afterRestart, beforeDownBranch, beforeUpBranch, close, onContradiction, onSolution
-
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
-
-
-
-
Constructor Detail
-
CPProfiler
public CPProfiler(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
-
disconnect
protected void disconnect()
- Specified by:
disconnect
in classSearchViz
-
sendNode
protected void sendNode(int nc, int pid, int alt, int kid, int rid, String label, String info)
-
sendSolution
protected void sendSolution(int nc, int pid, int alt, int kid, int rid, String label, String info)
- Specified by:
sendSolution
in classSearchViz
-
sendFailure
protected void sendFailure(int nc, int pid, int alt, int kid, int rid, String label, String info)
- Specified by:
sendFailure
in classSearchViz
-
sendRestart
protected void sendRestart(int rid)
- Specified by:
sendRestart
in classSearchViz
-
-