Skip to content

Optimizer returns empty model for unsatisfiable constraints #8102

Description

@humnrdble

If the difference between Solver and Optimize is intended, please add documentation for this.

from z3 import *
s = Optimize()
x = Bool("x")
s.add(x)
s.add(Not(x))
s.check() #unsat
s.model()

Output:

[]

Solver:

from z3 import *
s = Solver()
x = Bool("x")
s.add(x)
s.add(Not(x))
s.check() #unsat
s.model()

Output:

Z3Exception: model is not available

z3py Versions 4.14.1.0, 4.15.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions