Borrar filtros
Borrar filtros

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

4 visualizaciones (últimos 30 días)
Mathias Dirksmeier
Mathias Dirksmeier el 24 de Jul. de 2018
Editada: Mathias Dirksmeier el 24 de Jul. de 2018
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

Respuestas (0)

Categorías

Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by