Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose optimize.assertAndTrack to Java #5387

Merged
merged 1 commit into from
Jul 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/api/java/Optimize.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,28 @@ public void Add(Expr<BoolSort> ... constraints)
Assert(constraints);
}

/**
* 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 {@link #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 {@link #assertAndTrack}
* and the Boolean literals
* provided using {@link #check} with assumptions.
*/
public void AssertAndTrack(Expr<BoolSort> constraint, Expr<BoolSort> p)
{
getContext().checkContextMatch(constraint);
getContext().checkContextMatch(p);

Native.optimizeAssertAndTrack(getContext().nCtx(), getNativeObject(),
constraint.getNativeObject(), p.getNativeObject());
}

/**
* Handle to objectives returned by objective functions.
**/
Expand Down