필터 지우기
필터 지우기

Matlab, CPLEX and an easy LP, but...

조회 수: 3 (최근 30일)
Mathias Dirksmeier
Mathias Dirksmeier 2018년 7월 24일
편집: Mathias Dirksmeier 2018년 7월 24일
Hi all,
I know this is my third post and the problem is still of the same nature. However, our approach shifted a bit over time and I haven't got a satisfying response yet. Please, answer as comprehensively as possible - I seem to have a really hard time understanding the optimization syntax of Matlab.
I try to find a solution to a linear optimization problem. I want to maximize the total arbitrage value for one year. In each hour arbitrage can be defined as the product of price (Pt) and amount of energy (Et). The amount is positive when energy is bought and negative when energy is sold. The price is known (see attachement).
We would like to solve this problem with CPLEX.
Objective Function:
f = @(x)sum(x.*p);
I call the function as:
options = cplexoptimset('Diagnostics', 'on','Display','iter');
[x,fval] = cplexlp(f,Aineq,bineq,Aeq,beq,lb,ub,x0,options);
What I struggle with are the constraints:
0 <= St <= Smax (Smax = Energy Capacity, constant)
-Pmax <= x <= Pmax (Pmax = Power Limit, constant)
Whereas the Power Limit constraint looks fairly easy, how do I formulate the constraint for Energy Capacity? What I want to do is this:
St = St-1 + x * n , if x => 0 (with St-1 being the state of charge from the previous hour)
St = St-1 + x , if x < 0
So far, I try to formulate this as:
E = x;
E(x>0) = eta*E(x>0);
S = cumsum([Smax/2; x]);
Thus, I have a linear program that should be suitable for the CPLEX. Is there anybody who had some experiences with this solver and has an idea on how to formulate the problem? I would sell my soul to finally being able to solve this...
Thanks a lot and best regards, Mathias

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by