Open lsylusiyao opened 2 years ago
For inequalities: If A
is invertible, just rephrase your problem by setting x' = Ax
and solving for x'
. Or use the inequality constraint 1/A c <= x <= 1/A b
, which generalizes to the case that A
is not invertible if you appropriately split up the constraints into the invertible and the non-invertible part (the latter are trivial, i.e. absence of constraint).
For equalities: Mathematically, an equality Ax = b
is equivalent to the inequality b <= Ax <= b
. It is in general not advised to use this approach with numeric solvers as it may be unstable (but it still helps sometimes for a quick and dirty solution). Ideally, you would be able to first solve the equations and restrict your optimization problem to the subspace defined by them. E.g. in your example, when you first apply a shift by (-1/2, 0, 0)
you can eliminate x3
since the equation can then be read as -x1 - x2 = x3
.
Currently, I'm writing a quadratic minimization problem that looks like this (an example from matlab)
However, I don't know how to express the inequality constraint
c <= Ax <= b
(this is simplified here as0 <= x <= 1
but my problem is a little complex than that) and the equality constraintsum(x) = 1 / 2
. I didn't find any of this kind in the docs, examples, and unit tests. Thanks