How to use a function like "find" during an optimization process?

42 views
Skip to first unread message

Abdullah

unread,
Dec 22, 2019, 3:30:47 PM12/22/19
to YALMIP
Greetings,

I am using the solver IPOPT to solve a nonlinear and non-convex problem which was proposed in [1].

In a nutshell, assume we have a bounded variable t which is part of a set D. 

Untitled.png


During the optimization process, I want the solver to find the upper and lower closest values for t from D.  Let say the solver allocates value for = 0.14; then i want it simultaneously to find two parameters lower = 0.12 and upper = 0.22.

That has to be done during the optimization process not after termination as in some iterative methods.

Thank you.

[1] Soler, E. M., Asada, E. N., da Costa, G. R. M. (2013). Penalty-based nonlinear solver for optimal reactive power dispatch with discrete controls. IEEE Transactions on Power Systems. 28(3):2174-2182.

Johan Löfberg

unread,
Dec 23, 2019, 2:32:56 AM12/23/19
to YALMIP
You have to model it using binary variables and clever use of implies etc, i.e. logic programming

Your particular setup would be simple though with high-level logical ismember

x1 = sdpvar(1);
x1 = sdpvar(1);
model=[ismember(x1,[.12 .22 .32]),ismember(x2,[.12 .22 .32]),[x1<= t<=x2],abs(x1-x2)<=0.1]

Abdullah

unread,
Dec 23, 2019, 3:19:36 PM12/23/19
to YALMIP
Thank you Dr. Löfberg,

I tried your suggested code on a small simple example but it yields "Solver not applicable (ipopt)" error.

BTW, the proposed objective function in the literature is a penalty function to force the solver to allocate discrete values for t.

Obj = A  *  sin ( [ t / (upper-lower) ] *pi )^2

where A is a scaling factor.

Johan Löfberg

unread,
Dec 23, 2019, 3:51:22 PM12/23/19
to YALMIP
ipopt does not support integers hence that ismember construction won't work

that sin hack looks like a horrible hack, but what ever floats your boat...

Abdullah

unread,
Dec 23, 2019, 4:06:16 PM12/23/19
to YALMIP
tell me about it. 

I'm only comparing a model I'm building to this algorithm to show superiority.

In this case with the ipopt, what do you think will be the best way to do it?

Johan Löfberg

unread,
Dec 23, 2019, 4:53:54 PM12/23/19
to YALMIP
not using ipopt would be the only answer I can give

Abdullah

unread,
Dec 24, 2019, 1:34:29 PM12/24/19
to YALMIP
That defeats the purpose as the author of the paper claim they used ipopt to do this trick though GAMS!

Johan Löfberg

unread,
Dec 24, 2019, 1:56:17 PM12/24/19
to YALMIP
Well you can always sharpen the edge of a shovel to use it as a screwdriver, but in most cases it's probably better to simply use a screwdriver

In other words, sure use ipopt to solve mixed-integer nonlinear programs through that nonlinear penalty, but normally you are better of by using a solver developed for the purpose, or in this case by simply solving a sequence of problems instead
Reply all
Reply to author
Forward
0 new messages