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

Optimization gives incorrect model #5663

Closed
JoD opened this issue Nov 12, 2021 · 1 comment
Closed

Optimization gives incorrect model #5663

JoD opened this issue Nov 12, 2021 · 1 comment

Comments

@JoD
Copy link

JoD commented Nov 12, 2021

Running the following formula

(declare-fun local_parts () Bool)
(declare-fun nbparts () Int)
(declare-fun objective () Int)
(assert (and (< 1 nbparts) (= objective (+ (* (- nbparts) nbparts) nbparts (ite local_parts 9 0)))))
(maximize objective)
(check-sat)

on the command line via command

z3 -smt2 /tmp/file_with_above_formula -model

the returned solution is

sat
(
  (define-fun local_parts () Bool
    false)
  (define-fun nbparts () Int
    2)
  (define-fun objective () Int
    (- 2))
)

local_parts() should be true.

Z3 commit: 3c16edc

This is a distillation of https://gitlab.com/krr/IDP-Z3/-/issues/153

@JoD
Copy link
Author

JoD commented Nov 15, 2021

Thanks!

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

1 participant