0

I want to solve a system of nonlinear inequality equations, Simplify as follows: 12<xy<14 and 2x + 3*y>40, is there any way to find the minimum of x using python, i konw how to solve linear inequality quations with scipy.optimize.linprog,but i can't find the way to solve non-linear inequality quations,thanks

ELLEN
  • 65
  • 5
  • https://stackoverflow.com/questions/21765794/python-constrained-non-linear-optimization – Paul Cornelius Nov 23 '21 at 03:13
  • This particular system could be solved using only linear solvers: first consider that y is a parameter, and minimize x. This gives you a formula with the minimum x for each y. Then minimize this formula for y. – Stef Nov 23 '21 at 13:46

1 Answers1

1

Z3 is a SAT/SMT solver that could be interesting for this type of problems.

Here is an example looking for integer solutions. Note that the given equations are unbounded for floats.

from z3 import Optimize, Int, And

opt = Optimize()
x = Int('x')
y = Int('y')
opt.add(And(x * y > 12, x * y < 14))
opt.add(2 * x + 3 * y > 40)
opt.minimie(x)
print(opt.check())  # prints sat
print(opt.model())  # prints [y = 13, x = 1]
JohanC
  • 71,591
  • 8
  • 33
  • 66