Objective problem

24 views
Skip to first unread message

student1

unread,
May 8, 2019, 7:02:25 AM5/8/19
to YALMIP
Dear professor,

I have a problem and I don't know what to dnext.

Here I define two variables:


onoff = binvar(1,size(DatenNeu,1),'full');
onoff
= sdpvar(1,size(ZielVec,1),1,'full');



than I give constraints

Constraints = [];
for .....
...


than

objective = sum(abs(ZielVec-(Approxy/max(Approxy)))./ZielVec,1);

So this objective doesn't work. I will that objective totalize(sum) the ( ZielVec - (Approxy/the max. value of Approxy)) and this for every Point on Zielvec " ./ZielVec,1 "
But when I use "/max(Approxy)" it doesn't work.

I would be grateful to get your help.

Johan Löfberg

unread,
May 8, 2019, 7:09:06 AM5/8/19
to YALMIP
First, I guess you mean Approxy./max(Approxy)

If Approxy is a decision variable, you have a very very nasty nonlinear nonconvex objective

Johan Löfberg

unread,
May 8, 2019, 7:17:59 AM5/8/19
to YALMIP
skip my comment about the elementwise division, obviously not needed

Anyway, horrible objective, and you need to come up with a better objective, or a better formulation

student1

unread,
May 8, 2019, 7:29:25 AM5/8/19
to YALMIP
I'm sorry, the first two code lines must be=

onoff = binvar(1,size(DatenNeu,1),'full');
Approxy = sdpvar(1,size(ZielVec,1),1,'full');

..

now if I use the objective like this=

objective = sum(abs(ZielVec-Approxy)./ZielVec,1);

it works. But I need Approxy/max(Approxy)

Johan Löfberg

unread,
May 8, 2019, 7:34:29 AM5/8/19
to yal...@googlegroups.com
that problem is eons easier, at it is a simple LP objective.

If you don't trust me that the objective is horrible, just look at random instances in 2D
for i = 1:10
    y = randn(2,1);
    [X1,X2] = meshgrid(.1:0.011:2,.1:0.011:2);
    for i = 1:length(X1)
     for j = 1:length(X2)
         x = [X1(i,j);X2(i,j)];
         J(i,j) = sum(abs((y - x/max(x))./y));
     end
    end
    mesh(J)
pause(1)
end


Johan Löfberg

unread,
May 8, 2019, 7:37:07 AM5/8/19
to YALMIP
and 'full' is redundant for vectors (as it cannot be symmetric unless it's 1x1, where is both full and symmetric)

Johan Löfberg

unread,
May 8, 2019, 8:10:01 AM5/8/19
to yal...@googlegroups.com
Also note that the complexity of this problem depends on how Approxy enters other parts of the model, and what you know about the variable

Effectively, what you have written so far is a model of the following type
x = sdpvar(n,1);
optimize([],sum(abs((y - x/max(x))./y)))

If you know x>=0, this model is equivalent to solving
q = sdpvar(n,1);
optimize([0<=q<=1],sum(abs((y - q)./y)))
x = value(q)*anypositivenumber

etc
Reply all
Reply to author
Forward
0 new messages