How to define the right objective function in jump?Is there a problem with my definition? In addition, if the objective function is composed of multiple sub functions and cannot be represented by a single formula, the sub function!
Here is my source code
using JuMP, BilevelJuMP, Cbc
model = BilevelModel(Cbc.Optimizer, mode = BilevelJuMP.SOS1Mode())
T=1;
IMG=3;
a_m1=0.043;
b_m1=20;
c_m1=0;
a_m2=0.075;
b_m2=17.5;
c_m2=0;
PGm1min=10;
PGm1max=600;
PGm2min=10;
PGm2max=150;
PGD_EXmin=-150;#联络线交互功率下限
PGD_EXmax=150;#联络线交互功率上限
Plpgmin=0;
Plpgmax=50;
Cb=[0.47 0.47 0.47];
Cs=[0.43 0.43 0.43];
Pload=[420.13];
PPV=[0 0 0];
PWT=[40 40 40];
PDL=[ 0 10 15];
PES_BT_D=[45 45 48];
PES_BT_C=[0 0 0];
PES_CD_D=[0 0 5];
PES_CD_C=[0 0 0];
PES_HC_D=[0 0 10];
PES_HC_C=[0 0 0];
PMTmin=0;
PMTmax=60*ones(T,3)
@variable(Lower(model), PMT)
@variable(Upper(model), PGm1[1,1])
@variable(Upper(model), PGm2[1,2])
@variable(Upper(model), PGD_EX[1,3])
@variable(Upper(model), Plpg[1,1])
@objective(Upper(model), Min, a_m1PGm1^2+sum(a_m2PGm2^2)-sum((Cb+Cs).*PGD_EX))
@constraints(Upper(model), begin
PGm1min<=PGm1<=PGm1max
PGm2min<=PGm2<=PGm2max
PGm1+sum(PGm2,2)+Plpg==sum(PGD_EX,2)+Pload
PGD_EXmin<=PGD_EX<=PGD_EXmax
Plpgmin<=Plpg<=Plpgmax
end)
@objective(Lower(model), Min, 6*PMT)
@constraints(Lower(model), begin
PGD_EX+PWT+PPV+PMT+PES_BT_D==PDL+PES_BT_C
PMTmin<=PMT<=PMTmax
end)
optimize!(model)
objective_value(model) # = 3 * (3.5 * 8/15) + 8/15 # = 6.13…
value(PGD_EX) # = 3.5 * 8/15 # = 1.86…
value(PMT)
value(PGm1)
value(PGm2) # = 8/15 # = 0.53.
REI2QZYKOS5)O4LOVBO7SRH|690x376, 100% needs to be defined first, how to express it