Open MaxMayya opened 3 years ago
Hi @MaxMayya was looking at your particular example, a few comments from what I noticed overviewing your code:
min_interval
and max_interval
are the "linearization bounds" that means that given that we want to linearize x^2
it must contain the domine of x = f(y)
, in your case x = u(theta + 2pi * j) - r
therefore we want to study x \in [min_interval
, max_interval
] (they shouldn’t be equal, min_interval
< max_interval
)num_linspace
) this increments a lot the cost of optimization every time you increment that value, the trade-off is that it would be more imprecise if you use fewer intervals (for example 10) Some additional notes:
(about 2). ** the reason why we might be interested in modeling a QP in a linear solver is that you might have a big optimization linear-problem, and for some reason, you need to add a few quadratic functions. If that's not your case I would recommend choosing a non-linear solver.
(about 3). there is a more efficient way to linearize a function implemented in CBC, called SOS
I' didn’t use when I wrote this code because there was a bug on the SOS-CBC /python-mip
integration, which is now solved. That implementation should be working now, so it might be productive to use the SOS linearization
Thanks ! Hope it helps, let me know If you need anything else
Man! Thanks a lot for elaborating.
Sure x
is not within the approximation min/max limits. Shame on me!
Following your recommendation, I looked for other python interfaces and found pyomo which provides interface to multiple optimizers (including NL ones like IPOPT). Seems promising, I'll give it a shot.
Thanks again
Thank you for sharing this work. I tried to use
get_quadratic_appx
to approximate the following quadratic integer problem:where u (3d unit vector) and theta are angle-axis representation of a rotation and r (3d vector) is a groundtruth rotation (with no angle ambiguity). The idea is to pick the best j so that u|theta is as-close-as possible to r. when I change
min_interval
,max_interval
ornum_linspace
, results change drastically!here is a minimal code:
I'm I missing something?
Many thanks