Package com.microsoft.z3
Class Optimize
java.lang.Object
com.microsoft.z3.Z3Object
com.microsoft.z3.Optimize
Object for managing optimization context
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classOptimize.Handle<R extends Sort>Handle to objectives returned by objective functions. -
Method Summary
Modifier and TypeMethodDescriptionvoidAlias for Assert.voidAssert a constraint (or multiple) into the optimize solver.voidAssertAndTrack(Expr<BoolSort> constraint, Expr<BoolSort> p) Assert a constraint into the optimizer, and track it (in the unsat) core using the Boolean constant p.AssertSoft(Expr<BoolSort> constraint, int weight, String group) Assert soft constraint Return an objective which associates with the group of constraints.AssertSoft(Expr<BoolSort> constraint, String weight, String group) Assert soft constraint Return an objective which associates with the group of constraints.Check satisfiability of asserted constraints.voidParse an SMT-LIB2 file with optimization objectives and constraints.voidfromString(String s) Similar to FromFile.BoolExpr[]The set of asserted formulas.getHelp()A string that describes all available optimize solver parameters.getModel()The model of the last Check.Expr<?>[]The set of asserted formulas.Retrieves parameter descriptions for Optimize solver.Return a string the describes why the last to check returned unknownOptimize statistics.BoolExpr[]The unsat core of the lastCheck.<R extends Sort>
Optimize.Handle<R>MkMaximize(Expr<R> e) Declare an arithmetical maximization objective.<R extends Sort>
Optimize.Handle<R>MkMinimize(Expr<R> e) Declare an arithmetical minimization objective.voidPop()Backtrack one backtracking point.voidPush()Creates a backtracking point.voidsetParameters(Params value) Sets the optimize solver parameters.toString()Print the context to a String (SMT-LIB parseable benchmark).Methods inherited from class com.microsoft.z3.Z3Object
arrayLength, arrayToNative
-
Method Details
-
getHelp
A string that describes all available optimize solver parameters. -
setParameters
Sets the optimize solver parameters.- Throws:
Z3Exception
-
getParameterDescriptions
Retrieves parameter descriptions for Optimize solver. -
Assert
Assert a constraint (or multiple) into the optimize solver. -
Add
Alias for Assert. -
AssertAndTrack
Assert a constraint into the optimizer, and track it (in the unsat) core using the Boolean constant p. Remarks: This API is an alternative to #check with assumptions for extracting unsat cores. Both APIs can be used in the same solver. The unsat core will contain a combination of the Boolean variables provided using #assertAndTrack and the Boolean literals provided using #check with assumptions. -
AssertSoft
Assert soft constraint Return an objective which associates with the group of constraints. -
AssertSoft
Assert soft constraint Return an objective which associates with the group of constraints. -
Check
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
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
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
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
Declare an arithmetical minimization objective. Similar to MkMaximize. -
getReasonUnknown
Return a string the describes why the last to check returned unknown -
toString
Print the context to a String (SMT-LIB parseable benchmark). -
fromFile
Parse an SMT-LIB2 file with optimization objectives and constraints. The parsed constraints and objectives are added to the optimization context. -
fromString
Similar to FromFile. Instead it takes as argument a string. -
getAssertions
The set of asserted formulas. -
getObjectives
The set of asserted formulas. -
getStatistics
Optimize statistics.
-