37 return Native.optimizeGetHelp(getContext().nCtx(), getNativeObject());
47 Native.optimizeSetParams(getContext().nCtx(), getNativeObject(), value.getNativeObject());
55 return new ParamDescrs(getContext(), Native.optimizeGetParamDescrs(getContext().nCtx(), getNativeObject()));
63 getContext().checkContextMatch(constraints);
66 Native.optimizeAssert(getContext().nCtx(), getNativeObject(), a.getNativeObject());
93 getContext().checkContextMatch(constraint);
94 getContext().checkContextMatch(p);
96 Native.optimizeAssertAndTrack(getContext().nCtx(), getNativeObject(),
97 constraint.getNativeObject(), p.getNativeObject());
103 public static class Handle<R
extends Sort> {
106 private final int handle;
117 public Expr<R> getLower()
119 return opt.GetLower(handle);
125 public Expr<R> getUpper()
127 return opt.GetUpper(handle);
138 public Expr<?>[] getUpperAsVector()
140 return opt.GetUpperAsVector(handle);
148 public Expr<?>[] getLowerAsVector()
150 return opt.GetLowerAsVector(handle);
156 public Expr<R> getValue()
167 return getValue().toString();
179 return AssertSoft(constraint, Integer.
toString(weight), group);
190 getContext().checkContextMatch(constraint);
191 Symbol s = getContext().mkSymbol(group);
192 return new Handle<>(
this, Native.optimizeAssertSoft(getContext().nCtx(), getNativeObject(), constraint.getNativeObject(), weight, s.getNativeObject()));
203 if (assumptions ==
null) {
205 Native.optimizeCheck(
207 getNativeObject(), 0,
null));
211 Native.optimizeCheck(
232 Native.optimizePush(getContext().nCtx(), getNativeObject());
242 Native.optimizePop(getContext().nCtx(), getNativeObject());
254 long x = Native.optimizeGetModel(getContext().nCtx(), getNativeObject());
258 return new Model(getContext(), x);
273 ASTVector core =
new ASTVector(getContext(), Native.optimizeGetUnsatCore(getContext().nCtx(), getNativeObject()));
282 public <R extends Sort> Handle<R> MkMaximize(
Expr<R> e)
284 return new Handle<>(
this, Native.optimizeMaximize(getContext().nCtx(), getNativeObject(), e.getNativeObject()));
291 public <R extends Sort> Handle<R> MkMinimize(Expr<R> e)
293 return new Handle<>(
this, Native.optimizeMinimize(getContext().nCtx(), getNativeObject(), e.getNativeObject()));
299 private <R extends Sort> Expr<R> GetLower(
int index)
301 return (Expr<R>) Expr.create(getContext(), Native.optimizeGetLower(getContext().nCtx(), getNativeObject(), index));
307 private <R extends Sort> Expr<R> GetUpper(
int index)
309 return (Expr<R>) Expr.create(getContext(), Native.optimizeGetUpper(getContext().nCtx(), getNativeObject(), index));
317 private Expr<?>[] GetUpperAsVector(
int index) {
318 return unpackObjectiveValueVector(
319 Native.optimizeGetUpperAsVector(
320 getContext().nCtx(), getNativeObject(), index
330 private Expr<?>[] GetLowerAsVector(
int index) {
331 return unpackObjectiveValueVector(
332 Native.optimizeGetLowerAsVector(
333 getContext().nCtx(), getNativeObject(), index
338 private Expr<?>[] unpackObjectiveValueVector(
long nativeVec) {
339 ASTVector vec =
new ASTVector(
340 getContext(), nativeVec
343 (Expr<?>) vec.get(0), (Expr<?>) vec.get(1), (Expr<?>) vec.get(2)
353 return Native.optimizeGetReasonUnknown(getContext().nCtx(), getNativeObject());
362 return Native.optimizeToString(getContext().nCtx(), getNativeObject());
371 Native.optimizeFromFile(getContext().nCtx(), getNativeObject(), file);
379 Native.optimizeFromString(getContext().nCtx(), getNativeObject(), s);
387 ASTVector assertions =
new ASTVector(getContext(), Native.optimizeGetAssertions(getContext().nCtx(), getNativeObject()));
396 ASTVector objectives =
new ASTVector(getContext(), Native.optimizeGetObjectives(getContext().nCtx(), getNativeObject()));
405 return new Statistics(getContext(), Native.optimizeGetStatistics(getContext().nCtx(), getNativeObject()));
414 Optimize(Context ctx)
throws Z3Exception
416 super(ctx, Native.mkOptimize(ctx.nCtx()));
421 Native.optimizeIncRef(getContext().nCtx(), getNativeObject());
425 void addToReferenceQueue() {
426 getContext().getReferenceQueue().storeReference(
this, OptimizeRef::new);
429 private static class OptimizeRef
extends Z3ReferenceQueue.Reference<Optimize> {
431 private OptimizeRef(Optimize referent, ReferenceQueue<Z3Object> q) {
436 void decRef(Context ctx,
long z3Obj) {
437 Native.optimizeDecRef(ctx.nCtx(), z3Obj);