Java Reference

Java Reference

Detailed Description

Wrapper around the SAT solver.

This class proposes different solve() methods, as well as accessors to get the values of variables in the best solution, as well as general statistics of the search.

Definition at line 28 of file CpSolver.java.

Public Member Functions

 CpSolver ()
 Main construction of the CpSolver class. More...
 
CpSolverStatus solve (CpModel model)
 Solves the given model, and returns the solve status. More...
 
CpSolverStatus solve (CpModel model, CpSolverSolutionCallback cb)
 Solves the given model, calls the solution callback at each incumbent solution, and returns the solve status. More...
 
CpSolverStatus solveWithSolutionCallback (CpModel model, CpSolverSolutionCallback cb)
 Solves the given model, passes each incumber solution to the solution callback if not null, and returns the solve status. More...
 
CpSolverStatus searchAllSolutions (CpModel model, CpSolverSolutionCallback cb)
 Searches for all solutions of a satisfiability problem. More...
 
synchronized void stopSearch ()
 Stops the search asynchronously. More...
 
double objectiveValue ()
 Returns the best objective value found during search. More...
 
double bestObjectiveBound ()
 Returns the best lower bound found when minimizing, of the best upper bound found when maximizing. More...
 
long value (LinearArgument expr)
 Returns the value of a linear expression in the last solution found. More...
 
Boolean booleanValue (Literal var)
 Returns the Boolean value of a literal in the last solution found. More...
 
CpSolverResponse response ()
 Returns the internal response protobuf that is returned internally by the SAT solver. More...
 
long numBranches ()
 Returns the number of branches explored during search. More...
 
long numConflicts ()
 Returns the number of conflicts created during search. More...
 
double wallTime ()
 Returns the wall time of the search. More...
 
double userTime ()
 Returns the user time of the search. More...
 
List< Integer > sufficientAssumptionsForInfeasibility ()
 
SatParameters.Builder getParameters ()
 Returns the builder of the parameters of the SAT solver for modification. More...
 
void setLogCallback (Consumer< String > cb)
 Sets the log callback for the solver. More...
 
String responseStats ()
 Returns some statistics on the solution found as a string. More...
 
String getSolutionInfo ()
 Returns some information on how the solution was found, or the reason why the model or the parameters are invalid. More...
 

Constructor & Destructor Documentation

◆ CpSolver()

CpSolver ( )

Main construction of the CpSolver class.

Definition at line 30 of file CpSolver.java.

Member Function Documentation

◆ bestObjectiveBound()

double bestObjectiveBound ( )

Returns the best lower bound found when minimizing, of the best upper bound found when maximizing.

Definition at line 125 of file CpSolver.java.

◆ booleanValue()

Boolean booleanValue ( Literal  var)

Returns the Boolean value of a literal in the last solution found.

Definition at line 140 of file CpSolver.java.

◆ getParameters()

SatParameters.Builder getParameters ( )

Returns the builder of the parameters of the SAT solver for modification.

Definition at line 179 of file CpSolver.java.

◆ getSolutionInfo()

String getSolutionInfo ( )

Returns some information on how the solution was found, or the reason why the model or the parameters are invalid.

Definition at line 197 of file CpSolver.java.

◆ numBranches()

long numBranches ( )

Returns the number of branches explored during search.

Definition at line 155 of file CpSolver.java.

◆ numConflicts()

long numConflicts ( )

Returns the number of conflicts created during search.

Definition at line 160 of file CpSolver.java.

◆ objectiveValue()

double objectiveValue ( )

Returns the best objective value found during search.

Definition at line 117 of file CpSolver.java.

◆ response()

CpSolverResponse response ( )

Returns the internal response protobuf that is returned internally by the SAT solver.

Definition at line 150 of file CpSolver.java.

◆ responseStats()

String responseStats ( )

Returns some statistics on the solution found as a string.

Definition at line 189 of file CpSolver.java.

◆ searchAllSolutions()

CpSolverStatus searchAllSolutions ( CpModel  model,
CpSolverSolutionCallback  cb 
)

Searches for all solutions of a satisfiability problem.

This method searches for all feasible solutions of a given model. Then it feeds the solutions to the callback.

Note that the model cannot have an objective.

Parameters
modelthe model to solve
cbthe callback that will be called at each solution
Returns
the status of the solve (FEASIBLE, INFEASIBLE...)
Deprecated:
Use the solve() method with the same signature, after setting the enumerate_all_solution parameter to true.

Definition at line 93 of file CpSolver.java.

◆ setLogCallback()

void setLogCallback ( Consumer< String >  cb)

Sets the log callback for the solver.

Definition at line 184 of file CpSolver.java.

◆ solve() [1/2]

CpSolverStatus solve ( CpModel  model)

Solves the given model, and returns the solve status.

Definition at line 37 of file CpSolver.java.

◆ solve() [2/2]

CpSolverStatus solve ( CpModel  model,
CpSolverSolutionCallback  cb 
)

Solves the given model, calls the solution callback at each incumbent solution, and returns the solve status.

Definition at line 45 of file CpSolver.java.

◆ solveWithSolutionCallback()

CpSolverStatus solveWithSolutionCallback ( CpModel  model,
CpSolverSolutionCallback  cb 
)

Solves the given model, passes each incumber solution to the solution callback if not null, and returns the solve status.

Deprecated:
Use the solve() method with the same signature.

Definition at line 74 of file CpSolver.java.

◆ stopSearch()

synchronized void stopSearch ( )

Stops the search asynchronously.

Definition at line 110 of file CpSolver.java.

◆ sufficientAssumptionsForInfeasibility()

List<Integer> sufficientAssumptionsForInfeasibility ( )

Definition at line 174 of file CpSolver.java.

◆ userTime()

double userTime ( )

Returns the user time of the search.

Definition at line 170 of file CpSolver.java.

◆ value()

long value ( LinearArgument  expr)

Returns the value of a linear expression in the last solution found.

Definition at line 130 of file CpSolver.java.

◆ wallTime()

double wallTime ( )

Returns the wall time of the search.

Definition at line 165 of file CpSolver.java.


The documentation for this class was generated from the following file: