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

Semantics of "box" for "opt.priority" optimization #7240

Open
mikand opened this issue May 31, 2024 · 2 comments
Open

Semantics of "box" for "opt.priority" optimization #7240

mikand opened this issue May 31, 2024 · 2 comments

Comments

@mikand
Copy link

mikand commented May 31, 2024

I am implementing OMT support for pysmt [1] and I found a strange discrepancy between Z3 and optimathsat in the semantics of the "box" multi-objective optimization semantics.

My understanding is that "box" for n objectives is equivalent to solving each objective as a separate OMT problem.

Now, consider the example on the Z3 example page [2]:

(declare-const x Real)
(declare-const y Real)
(assert (>= 5 (- x y)))
(assert (>= x 0))
(assert (>= 4 y))
(assert (> y 0))
(minimize x)
(maximize (+ x y))
(minimize y)
(maximize y)
(set-option :opt.priority box)
(check-sat)
(get-objectives)

Z3 gives:

sat
(objectives
 (x 0)
 ((+ x y) 4)
 (y 1)
 (y 1)
)

whereas OptiMathSAT gives:

sat
(objectives
 (x 0)
 ((+ x y) 13)
 (y (+ 0 epsilon))
 (y 4)
)

OptiMathSAT output is in line with the definition above, while I do not understand the result produced by Z3.

Is this a bug or Z3 adopts a different semantics?

[1] pysmt/pysmt#439
[2] https://microsoft.github.io/z3guide/docs/optimization/combiningobjectives/

@LeventErkok
Copy link

I think this is duplicate of #5314

in short, z3 no longer guarantees generating infinitesimals in the presence of strict inequalities. Nikolaj mentioned difficulties with integrating different theories in the presence of epsilons, which intuitively makes sense.

I think the real difficulty for upstream tools is knowing when this happens, which is not a readily available piece of information I’m afraid.

@mikand
Copy link
Author

mikand commented Jun 3, 2024

@LeventErkok thanks for the pointer (which is useful), but I think the issue here is different: substituting the strict inequality with a >= gets rid of the epsilon (concrete minimal models exist), but the box optimization still does not comply with the semantics I have in mind:

(declare-const x Real)
(declare-const y Real)
(assert (>= 5 (- x y)))
(assert (>= x 0))
(assert (>= 4 y))
(assert (>= y 0))
(minimize x)
(maximize (+ x y))
(minimize y)
(maximize y)
(set-option :opt.priority box)
(check-sat)

Z3 gives

sat
(objectives
 (x 0)
 ((+ x y) 13)
 (y 0)
 (y 0)
)

OptiMathSAT gives

sat
(objectives
 (x 0)
 ((+ x y) 13)
 (y 0)
 (y 4)
)

mikand added a commit to pysmt/pysmt that referenced this issue Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants