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

Performance hit when adding an "unrelated" variable to optimization problem. #320

Open
kunalsheth opened this issue Nov 19, 2024 · 0 comments

Comments

@kunalsheth
Copy link

Observation:

Adding an 'unrelated' variable+assertion causes ~50ms linear optimization query to no longer terminate.

Expected Behavior:

I thought dreal_query_FAST.smt2 and dreal_query_SLOW.smt2 would finish in similar amounts of time.

I thought this because variable_X does not impose any additional constraints on the relationship between variable_A and variable_B nor does the minimize expression depend on variable_X.

Actual Behavior:

dreal_query_FAST.smt2:

(set-option :precision 1e-16)

(declare-const variable_X Real)
(declare-const variable_A Real)
(declare-const variable_B Real)

(assert (and (<= variable_B 3) (>= variable_B 0)))
(assert (and (<= variable_A 3) (>= variable_A 0)))

; MAGIC LINE THAT BREAKS THINGS:
; (assert (= variable_X (+ 4e-10 (* 1e-10 variable_B) (* -1e-10 variable_A)) ))
(minimize               (+ 4e-10 (* 1e-10 variable_B) (* -1e-10 variable_A))  )

(check-sat)
(get-model)
(exit)

Result of time cat dreal_query_FAST.smt2 | dreal --in:

delta-sat with delta = 1e-16
(model
  (define-fun variable_X () Real [-4.9999999999999999e-17, 4.9999999999999999e-17])
  (define-fun variable_A () Real 2.9999999998253761)
  (define-fun variable_B () Real [1.7462398116453833e-10, 1.7462408116453831e-10])
)

________________________________________________________
Executed in   39.08 millis    fish           external
   usr time   30.41 millis    0.30 millis   30.11 millis
   sys time   13.56 millis    1.61 millis   11.95 millis

dreal_query_SLOW.smt2:

(set-option :precision 1e-16)

(declare-const variable_X Real)
(declare-const variable_A Real)
(declare-const variable_B Real)

(assert (and (<= variable_B 3) (>= variable_B 0)))
(assert (and (<= variable_A 3) (>= variable_A 0)))

; MAGIC LINE THAT BREAKS THINGS:
(assert (= variable_X (+ 4e-10 (* 1e-10 variable_B) (* -1e-10 variable_A)) ))
(minimize             (+ 4e-10 (* 1e-10 variable_B) (* -1e-10 variable_A))  )

(check-sat)
(get-model)
(exit)

Result of time cat dreal_query_SLOW.smt2 | dreal --in:
Nothing- Still running after 30 minutes.

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