Z3
Data Structures | Public Member Functions
Optimize Class Reference
+ Inheritance diagram for Optimize:

Data Structures

class  Handle
 

Public Member Functions

String getHelp ()
 
void setParameters (Params value)
 
ParamDescrs getParameterDescriptions ()
 
void Assert (BoolExpr...constraints)
 
void Add (BoolExpr...constraints)
 
Handle AssertSoft (BoolExpr constraint, int weight, String group)
 
Status Check ()
 
void Push ()
 
void Pop ()
 
Model getModel ()
 
Handle MkMaximize (ArithExpr e)
 
Handle MkMinimize (ArithExpr e)
 
String getReasonUnknown ()
 
String toString ()
 
Statistics getStatistics ()
 
- Public Member Functions inherited from Z3Object
void dispose ()
 
- Public Member Functions inherited from IDisposable
void dispose ()
 

Additional Inherited Members

- Protected Member Functions inherited from Z3Object
void finalize ()
 

Detailed Description

Object for managing optimizization context

Definition at line 28 of file Optimize.java.

Member Function Documentation

void Add ( BoolExpr...  constraints)
inline

Alias for Assert.

Definition at line 71 of file Optimize.java.

72  {
73  Assert(constraints);
74  }
void Assert(BoolExpr...constraints)
Definition: Optimize.java:59
void Assert ( BoolExpr...  constraints)
inline

Assert a constraint (or multiple) into the optimize solver.

Definition at line 59 of file Optimize.java.

Referenced by Optimize.Add().

60  {
61  getContext().checkContextMatch(constraints);
62  for (BoolExpr a : constraints)
63  {
64  Native.optimizeAssert(getContext().nCtx(), getNativeObject(), a.getNativeObject());
65  }
66  }
Handle AssertSoft ( BoolExpr  constraint,
int  weight,
String  group 
)
inline

Assert soft constraint

Return an objective which associates with the group of constraints.

Definition at line 129 of file Optimize.java.

130  {
131  getContext().checkContextMatch(constraint);
132  Symbol s = getContext().mkSymbol(group);
133  return new Handle(this, Native.optimizeAssertSoft(getContext().nCtx(), getNativeObject(), constraint.getNativeObject(), Integer.toString(weight), s.getNativeObject()));
134  }
IntSymbol mkSymbol(int i)
Definition: Context.java:72
Status Check ( )
inline

Check satisfiability of asserted constraints. Produce a model that (when the objectives are bounded and don't use strict inequalities) meets the objectives.

Definition at line 143 of file Optimize.java.

144  {
145  Z3_lbool r = Z3_lbool.fromInt(Native.optimizeCheck(getContext().nCtx(), getNativeObject()));
146  switch (r) {
147  case Z3_L_TRUE:
148  return Status.SATISFIABLE;
149  case Z3_L_FALSE:
150  return Status.UNSATISFIABLE;
151  default:
152  return Status.UNKNOWN;
153  }
154  }
Z3_lbool
Lifted Boolean type: false, undefined, true.
Definition: z3_api.h:143
Status
Status values.
Definition: Status.cs:27
String getHelp ( )
inline

A string that describes all available optimize solver parameters.

Definition at line 33 of file Optimize.java.

34  {
35  return Native.optimizeGetHelp(getContext().nCtx(), getNativeObject());
36  }
Model getModel ( )
inline

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.

Definition at line 183 of file Optimize.java.

184  {
185  long x = Native.optimizeGetModel(getContext().nCtx(), getNativeObject());
186  if (x == 0)
187  return null;
188  else
189  return new Model(getContext(), x);
190  }
ParamDescrs getParameterDescriptions ( )
inline

Retrieves parameter descriptions for Optimize solver.

Definition at line 51 of file Optimize.java.

52  {
53  return new ParamDescrs(getContext(), Native.optimizeGetParamDescrs(getContext().nCtx(), getNativeObject()));
54  }
String getReasonUnknown ( )
inline

Return a string the describes why the last to check returned unknown

Definition at line 231 of file Optimize.java.

232  {
233  return Native.optimizeGetReasonUnknown(getContext().nCtx(),
234  getNativeObject());
235  }
Statistics getStatistics ( )
inline

Optimize statistics.

Definition at line 249 of file Optimize.java.

250  {
251  return new Statistics(getContext(), Native.optimizeGetStatistics(getContext().nCtx(), getNativeObject()));
252  }
Handle MkMaximize ( ArithExpr  e)
inline

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.

Definition at line 197 of file Optimize.java.

198  {
199  return new Handle(this, Native.optimizeMaximize(getContext().nCtx(), getNativeObject(), e.getNativeObject()));
200  }
Handle MkMinimize ( ArithExpr  e)
inline

Declare an arithmetical minimization objective. Similar to MkMaximize.

Definition at line 206 of file Optimize.java.

207  {
208  return new Handle(this, Native.optimizeMinimize(getContext().nCtx(), getNativeObject(), e.getNativeObject()));
209  }
void Pop ( )
inline

Backtrack one backtracking point.

Note that an exception is thrown if Pop is called without a corresponding Push.

Definition at line 171 of file Optimize.java.

172  {
173  Native.optimizePop(getContext().nCtx(), getNativeObject());
174  }
void Push ( )
inline

Creates a backtracking point.

Definition at line 159 of file Optimize.java.

160  {
161  Native.optimizePush(getContext().nCtx(), getNativeObject());
162  }
void setParameters ( Params  value)
inline

Sets the optimize solver parameters.

Exceptions
Z3Exception

Definition at line 43 of file Optimize.java.

44  {
45  Native.optimizeSetParams(getContext().nCtx(), getNativeObject(), value.getNativeObject());
46  }
String toString ( )
inline

Print the context to a String (SMT-LIB parseable benchmark).

Definition at line 241 of file Optimize.java.

242  {
243  return Native.optimizeToString(getContext().nCtx(), getNativeObject());
244  }