0

I'm trying to solve a linear program in python. My (simplified) problem is:

Minimize: ||X*b||

subject to LB < A*X <UB

X: 165x11, b:11x0, A: 1x165, LB: 1x11, UB: 1x11

X: only variables

b, A, LB, UB : known vectors/matrix

(||..|| representing Euclidean norm)

Does anyone know how to solve such a problem?

I'm currently using Scipy.optimize and scipy.linear.constraints. However, scipy.linear.constraints does not accept linear constraints where 'X' is a matrix (only as a vector).

I'm happy to change package if required.

  • If you really want to implement it in matrix notation, a package like [cvxpy](https://www.cvxpy.org/) is probably the better choice. In addition to that, it interfaces more sophisticated solvers for convex optimization problems than scipy. If you're stick to scipy.optimize.minimize, you need to write the objective and the constraints as usual functions of a vector x with 165*11 entries. However, you can reshape this flattened vector x into a matrix X by `X = x.reshape(165,11)` inside your functions and then implement the objective and the constraints accordingly. – joni Nov 01 '22 at 11:00

0 Answers0