error in solving a LP model: Problem unbounded

2 views (last 30 days)
I built a LP model and when solving I got the message 'Problem is unbounded'. However, I solved the same problem with GAMS and I got
the following output
**** SOLVER STATUS 1 Normal Completion
**** MODEL STATUS 1 Optimal
**** OBJECTIVE VALUE 3164404.6058
Please help me to find what I got wrong in the code. Find attached the data and the code.
  3 Comments
karim bio gassi
karim bio gassi on 6 Nov 2021
Edited: karim bio gassi on 7 Nov 2021
I am sorry that the code is a mess. Iam quite new in optimization with matlab and this code is my first code using matlab. I generally use GAMS to solve optimization problems.
Please precise me where are the syntax issues so that I can correct them.
I am solving a energy management problem based on electrical and heat storage energy level. I have
15 decisions variables function of time, x1 to x10;and y1 to y5. the y variables have 2 components th 1:heating and 2: cooling reason why I create the optimization variables as
x = optimvar('x',10,t,'LowerBound',0);
y = optimvar('y',5,t,th,'LowerBound',0); with t representing the scheduling horizon t=8760h
the objective function is the sum over the scheduling horizon of 8760 hours of the cost of the energy bought from the grid, produced by the renewable energy source, the electrical and heating storage and the electrical, heating and cooling shedding cost.
k_grid*a_grid'.*(x(1,:)+x(2,:)+(y(1,:,1)+y(1,:,2))+x(3,:))
a_rer*(x(4,:)+x(5,:)+(y(2,:,1)+y(2,:,2))+x(6,:))
h_E*(x(9,:)+beta_c_E*(x(2,:)+x(5,:))-x(7,:))
h_T *(x(10,:)+ beta_c_T*(x(8,:)+y(4,:,2))-(y(5,:,2)+y(5,:,1))))
b_T(1,1)*(Q_L(:,1)'-(y(3,:,1)+ beta_d_T*cop_ab*y(5,:,1)))
b_T(1,2)*(Q_L(:,2)'-(y(3,:,2)+beta_d_T*y(5,:,2)))
the electrical and heat storage energy level evolved following
eq2 = x(9,2:t)==x(9,1:t-1)+beta_c_E*(x(2,1:t-1)+x(5,1:t-1))-x(7,1:t-1);
eq3 = x(10,2:t)==x(10,1:t-1)+beta_c_T*(x(8,1:t-1)+ y(4,1:t-1,2))-(y(5,1:t-1,2)+y(5,1:t-1,1));
I used variable x9 and x10 to represent the electrical and heat storage level respectively.
the initial energy level of the electrical and heating storage are giving by the constraints
dmm.Constraints.R_initial = x(9,1)==0;
dmm.Constraints.Q_initial = x(10,1)==0;
the remaining constraints are described in the matlab code.
Please help me I really need this code in matlab for further works.
karim bio gassi
karim bio gassi on 8 Nov 2021
Hi everyone
I have checked the optimization built in matlab with the one I built in gams. I seems that the model was not a mess as said by John D'Errico as all the equations are respectively similar in matlab and gams. the only one difference is the solver linprog and cplex for matlab and gams respectively.
I wonder if someone that has cplex solver for matlab can help me solve the model.
Thanks. find attach the matlab code and the data.

Sign in to comment.

Answers (0)

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!