public interface IOptimizationProblem extends IProblem
 boolean isSatisfiable = false;
 
 IOptimizationProblem optproblem = (IOptimizationProblem) problem;
 
 try {
     while (optproblem.admitABetterSolution()) {
         if (!isSatisfiable) {
             if (optproblem.nonOptimalMeansSatisfiable()) {
                 setExitCode(ExitCode.SATISFIABLE);
                 if (optproblem.hasNoObjectiveFunction()) {
                     return;
                 }
                 log("SATISFIABLE"); //$NON-NLS-1$
             }
             isSatisfiable = true;
             log("OPTIMIZING..."); //$NON-NLS-1$
         }
         log("Got one! Elapsed wall clock time (in seconds):" //$NON-NLS-1$
                 + (System.currentTimeMillis() - getBeginTime()) / 1000.0);
         getLogWriter().println(
                 CURRENT_OPTIMUM_VALUE_PREFIX + optproblem.getObjectiveValue());
         optproblem.discardCurrentSolution();
     }
     if (isSatisfiable) {
         setExitCode(ExitCode.OPTIMUM_FOUND);
     } else {
         setExitCode(ExitCode.UNSATISFIABLE);
     }
 } catch (ContradictionException ex) {
     assert isSatisfiable;
     setExitCode(ExitCode.OPTIMUM_FOUND);
 }
 | Modifier and Type | Method and Description | 
|---|---|
boolean | 
admitABetterSolution()
Look for a solution of the optimization problem. 
 | 
boolean | 
admitABetterSolution(IVecInt assumps)
Look for a solution of the optimization problem when some literals are
 satisfied. 
 | 
Number | 
calculateObjective()
Deprecated.  
 | 
void | 
discard()
Deprecated.  
 | 
void | 
discardCurrentSolution()
Discard the current solution in the optimization problem. 
 | 
void | 
forceObjectiveValueTo(Number forcedValue)
Force the value of the objective function. 
 | 
Number | 
getObjectiveValue()
Read only access to the value of the objective function for the current
 solution. 
 | 
boolean | 
hasNoObjectiveFunction()
If the optimization problem has no objective function, then it is a
 simple decision problem. 
 | 
boolean | 
isOptimal()
Allows to check afterwards if the solution provided by the solver is
 optimal or not. 
 | 
boolean | 
nonOptimalMeansSatisfiable()
A suboptimal solution has different meaning depending of the optimization
 problem considered. 
 | 
void | 
setTimeoutForFindingBetterSolution(int seconds)
Allow to set a specific timeout when the solver is in optimization mode. 
 | 
findModel, findModel, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, model, nConstraints, newVar, nVars, primeImplicant, primeImplicant, printInfos, printInfosmodelboolean admitABetterSolution()
                             throws TimeoutException
TimeoutException - if the solver cannot answer in reasonable time.ISolver.setTimeout(int)boolean admitABetterSolution(IVecInt assumps) throws TimeoutException
assumps - a set of literals in Dimacs format.TimeoutException - if the solver cannot answer in reasonable time.ISolver.setTimeout(int)boolean hasNoObjectiveFunction()
boolean nonOptimalMeansSatisfiable()
@Deprecated Number calculateObjective()
getObjectiveValue()Number getObjectiveValue()
void forceObjectiveValueTo(Number forcedValue) throws ContradictionException
ContradictionException@Deprecated void discard() throws ContradictionException
ContradictionException - if a trivial inconsistency is detected.discardCurrentSolution()void discardCurrentSolution()
                            throws ContradictionException
ContradictionException - if a trivial inconsistency is detected.boolean isOptimal()
void setTimeoutForFindingBetterSolution(int seconds)
Copyright © 2013 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.