Solving inequality of multiple variables

45 Views Asked by At

What should be a general approach towards solving these kind of questions algebraically?

I tried to code this up and find a solution but I don't know whether it's correct or not. As I've used a scipy package and don't know the theory of this problem that well.

from scipy.optimize import linprog

#linprog solves for minima so change of sign.

c = [-1, -1, -1, -1, -1, -1, -1, -1, -1]  # Objective function

# Inequality matrix
A = [
    [-1, 2, -3, 4, -5, 6, -7, 8, -9],
    [-9, 8, -7, 6, -5, 4, -3, 2, -1],
    [1, -1, 1, -1, 1, -1, 1, -1, 1]
]

# RHS
b = [-1, -2, 0.2]

result = linprog(c, A_ub=A, b_ub=b, method='highs')

result.success, result.x
2

There are 2 best solutions below

0
On BEST ANSWER

This is an instance of linear programming. Use any linear programming solver; or any algorithm for solving linear programming. There are many options.

0
On

You can just use Fourier Motzkin elimination to deal with them systematically