org.opt4j.satdecoding
Class PooledSolver

java.lang.Object
  extended by org.opt4j.satdecoding.PooledSolver
All Implemented Interfaces:
Solver

public class PooledSolver
extends java.lang.Object
implements Solver

The PooledSolver is a decorator that enables pooling of Solver instances and, therefore, a parallel execution of the Solvers.


Field Summary
protected  java.util.concurrent.BlockingQueue<Solver> queue
           
protected  java.util.Set<Solver> solvers
           
 
Constructor Summary
PooledSolver(com.google.inject.Provider<Solver> solverProvider, int instances)
          Constructs a PooledSolver.
 
Method Summary
 void addConstraint(Constraint constraint)
          Adds a Constraint to the Solver.
 Model solve(Order order)
          Solve the problem defined by the constraints with a given order (branching strategy).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

solvers

protected final java.util.Set<Solver> solvers

queue

protected final java.util.concurrent.BlockingQueue<Solver> queue
Constructor Detail

PooledSolver

@Inject
public PooledSolver(com.google.inject.Provider<Solver> solverProvider,
                           int instances)
Constructs a PooledSolver.

Parameters:
solverProvider - a solver provider
instances - the number of pooled instances
Method Detail

addConstraint

public void addConstraint(Constraint constraint)
Description copied from interface: Solver
Adds a Constraint to the Solver.

Specified by:
addConstraint in interface Solver
Parameters:
constraint - the added constraint

solve

public Model solve(Order order)
            throws TimeoutException
Description copied from interface: Solver
Solve the problem defined by the constraints with a given order (branching strategy).

Specified by:
solve in interface Solver
Parameters:
order - the branching strategy
Returns:
a model that represents a feasible solution
Throws:
TimeoutException - if a feasible solution cannot be found within a given amount of time