indicator function in the objective

107 views
Skip to first unread message

Xiao Wang

unread,
May 1, 2019, 10:10:08 AM5/1/19
to YALMIP
Dear Johan,

I am trying to use YALMIP solving power dispatch in an electric network. The following code is for the dual update in ADMM:

P_gen_c=sdpvar(n_gen,1);
d=(sum(P_gen_c)-sum(mpc.bus(:,3)/mpc.baseMVA))~=0; %binary
objective=d*1e9+Rou/2*sum((P_gen_c-u-P_gen_S(:,it)).^2); % indicator
constraints=[mpc.gen(:,10)<=P_gen_c*mpc.baseMVA<=mpc.gen(:,9)];
optimize(constraints,objective, opt);

I expect that P_gen_c should be the values, whose sum equals to the sum of loads (sum(mpc.bus(:,3)/mpc.baseMVA)), since a large penalty (1e9) is posed on the unbalance. However, P_gen_c  turns out to be zero according to the optimization results (value(d)=0 and value(obj)=1e9). I guess there might be some errors. Could you kindly help me with this?

Johan Löfberg

unread,
May 1, 2019, 10:14:19 AM5/1/19
to YALMIP
You have to model it using implies


in your case, manually it would be

binvar d
Model =[-M*d<=
(sum(P_gen_c)-sum(mpc.bus(:,3)/mpc.baseMVA))<=M*d]


Reply all
Reply to author
Forward
0 new messages