How can I get energy price in the unit commitment problem?

103 views
Skip to first unread message

Lawrence

unread,
Jul 21, 2016, 6:22:59 AM7/21/16
to YALMIP
Hi,

I'm using YALMIP to solve a unit commitment (UC) problem, and now I have a problem about calculating the energy price. I solve the UC with the MILP method as the example in the YALMIP website, and then value the onoff variables and optimize it again, but the result of dual(constraints) is NaN while the . The code is shown below:

Nunits = 3;
Horizon = 48;

Pmax = [100;50;25];
Pmin = [20;40;1];

Q = diag([.04 .01 .02]);
C = [10 20 20];

Pforecast = 100 + 50*sin((1:Horizon)*2*pi/24);

onoff = binvar(Nunits,Horizon,'full');
P     = sdpvar(Nunits,Horizon,'full');

Constraints = [];
for k = 1:Horizon
  Constraints = [Constraints, onoff(:,k).*Pmin <= P(:,k) <= onoff(:,k).*Pmax];
end
for k = 1:Horizon
  Constraints = [Constraints, sum(P(:,k)) >= Pforecast(k)];
end
Objective = 0;
for k = 1:Horizon
  Objective = Objective + P(:,k)'*Q*P(:,k) + C*P(:,k);
end

optimize(Constraints,Objective);

onoff=value(onoff);

optimize(Constraints,Objective)
dual(Constraints(2))

The Matlab output:

SCIP Status        : problem is solved [optimal solution found]
Solving Time (sec) : 0.20
Solving Nodes      : 1
Primal Bound       : +7.02575353764882e+04 (5 solutions)
Dual Bound         : +7.02575353764882e+04
Gap                : 0.00 

ans = 

    yalmiptime: 0.1541
    solvertime: 0.2359
          info: 'Infeasible problem (SCIP-linear)'
       problem: 1


ans =

   NaN
   NaN
   NaN
   NaN
   NaN
   NaN

The matlab version is R2013b, the OptiToolbox version is edu V2.21, the yalmip version is 19-sep-2015. 

I will very appreciate it if someone can help me.

Thank you!

Lawrence

Johan Löfberg

unread,
Jul 21, 2016, 6:24:52 AM7/21/16
to YALMIP

Lawrence

unread,
Jul 21, 2016, 7:43:12 AM7/21/16
to YALMIP
Thanks for the reply. I copied the code in the link you provided but still got NaN. So is there something wrong with my solver? Thanks! 

Matlab Output:

SCIP Status        : problem is solved [optimal solution found]
Solving Time (sec) : 0.07
Solving Nodes      : 1
Primal Bound       : -4.41887640171600e-01 (2 solutions)
Dual Bound         : -4.41887640171600e-01
Gap                : 0.00 

ans =

   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN
   NaN

Johan Löfberg

unread,
Jul 21, 2016, 7:53:29 AM7/21/16
to YALMIP
scip does not return duals

help scip
...
    Return arguments:
        x - solution vector
        fval - objective value at the solution
        exitflag - exit status (see below)
        stats - statistics structure
 


Lawrence

unread,
Jul 22, 2016, 4:45:30 AM7/22/16
to YALMIP
I change the solver to linprog and everything works well. Thank you very much!

Lawrence
Reply all
Reply to author
Forward
0 new messages