Package com.microsoft.z3
Class Optimize
- java.lang.Object
-
- com.microsoft.z3.Z3Object
-
- com.microsoft.z3.Optimize
-
public class Optimize extends Z3Object
Object for managing optimization context
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOptimize.HandleHandle to objectives returned by objective functions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidAdd(BoolExpr... constraints)Alias for Assert.voidAssert(BoolExpr... constraints)Assert a constraint (or multiple) into the optimize solver.Optimize.HandleAssertSoft(BoolExpr constraint, int weight, String group)Assert soft constraint Return an objective which associates with the group of constraints.StatusCheck(Expr... assumptions)Check satisfiability of asserted constraints.voidfromFile(String file)Parse an SMT-LIB2 file with optimization objectives and constraints.voidfromString(String s)Similar to FromFile.BoolExpr[]getAssertions()The set of asserted formulas.StringgetHelp()A string that describes all available optimize solver parameters.ModelgetModel()The model of the last Check.Expr[]getObjectives()The set of asserted formulas.ParamDescrsgetParameterDescriptions()Retrieves parameter descriptions for Optimize solver.StringgetReasonUnknown()Return a string the describes why the last to check returned unknownStatisticsgetStatistics()Optimize statistics.BoolExpr[]getUnsatCore()The unsat core of the lastCheck.Optimize.HandleMkMaximize(Expr e)Declare an arithmetical maximization objective.Optimize.HandleMkMinimize(Expr e)Declare an arithmetical minimization objective.voidPop()Backtrack one backtracking point.voidPush()Creates a backtracking point.voidsetParameters(Params value)Sets the optimize solver parameters.StringtoString()Print the context to a String (SMT-LIB parseable benchmark).-
Methods inherited from class com.microsoft.z3.Z3Object
arrayLength, arrayToNative
-
-
-
-
Method Detail
-
getHelp
public String getHelp()
A string that describes all available optimize solver parameters.
-
setParameters
public void setParameters(Params value)
Sets the optimize solver parameters.- Throws:
Z3Exception
-
getParameterDescriptions
public ParamDescrs getParameterDescriptions()
Retrieves parameter descriptions for Optimize solver.
-
Assert
public void Assert(BoolExpr... constraints)
Assert a constraint (or multiple) into the optimize solver.
-
Add
public void Add(BoolExpr... constraints)
Alias for Assert.
-
AssertSoft
public Optimize.Handle AssertSoft(BoolExpr constraint, int weight, String group)
Assert soft constraint Return an objective which associates with the group of constraints.
-
Check
public Status Check(Expr... assumptions)
Check satisfiability of asserted constraints. Produce a model that (when the objectives are bounded and don't use strict inequalities) meets the objectives.
-
Push
public void Push()
Creates a backtracking point.
-
Pop
public void Pop()
Backtrack one backtracking point. Note that an exception is thrown if Pop is called without a corresponding Push.
-
getModel
public Model getModel()
The model of the last Check. The result is null if Check was not invoked before, if its results was not SATISFIABLE, or if model production is not enabled.
-
getUnsatCore
public BoolExpr[] getUnsatCore()
The unsat core of the lastCheck. Remarks: The unsat core is a subset ofAssumptionsThe result is empty ifCheckwas not invoked before, if its results was notUNSATISFIABLE, or if core production is disabled.- Throws:
Z3Exception
-
MkMaximize
public Optimize.Handle MkMaximize(Expr e)
Declare an arithmetical maximization objective. Return a handle to the objective. The handle is used as to retrieve the values of objectives after calling Check.
-
MkMinimize
public Optimize.Handle MkMinimize(Expr e)
Declare an arithmetical minimization objective. Similar to MkMaximize.
-
getReasonUnknown
public String getReasonUnknown()
Return a string the describes why the last to check returned unknown
-
toString
public String toString()
Print the context to a String (SMT-LIB parseable benchmark).
-
fromFile
public void fromFile(String file)
Parse an SMT-LIB2 file with optimization objectives and constraints. The parsed constraints and objectives are added to the optimization context.
-
fromString
public void fromString(String s)
Similar to FromFile. Instead it takes as argument a string.
-
getAssertions
public BoolExpr[] getAssertions()
The set of asserted formulas.
-
getObjectives
public Expr[] getObjectives()
The set of asserted formulas.
-
getStatistics
public Statistics getStatistics()
Optimize statistics.
-
-