You welcome. I like to share experience about this nice scheduling language CPO
The code I send is still open to reformulations. For instance, it allows to "open" a variable number of plants of the same type at different time periods, whereas in your example, it seems to me you want to use all these plants together
PS : do not hesitate to contact me in private message if you have questions that are not worth discussing here: david dot gravot at decisionbrain dot com
Original Message:
Sent: Wed June 21, 2023 08:22 AM
From: Pierre Chavanne
Subject: Cplex - Python mixed problem Decision-MILP
Dear David,
Many thanks for your response with all these details : I really appreciate you wrote an opl script to illustrate your point of view.
I will work on it to adapt in Python. To be honest, I did this naive example on a sheet of paper thinking about a basic solution : I think it is the optimal one but not sure...
Thank you very much for your help.
Kind regards.
Pierre
------------------------------
Pierre Chavanne
Original Message:
Sent: Mon June 12, 2023 01:21 PM
From: David Gravot
Subject: Cplex - Python mixed problem Decision-MILP
Yes, that's the idea. Not sure it will scale up if you have a huge number of facilities, and a very long horizon, but for your dataset, I find a cover that looks like your solution after 10 seconds. It does not provide the optimal (?) solution you provided even giving more time
I attach the opl model and data files (I'm not skilled in Python), I guess you can adapt it in python. The idea is to create optional pattern intervals , here at most 10 occurences for each pattern nuc, gas, biomass. They will represent the various occurences of each pattern over time. Actually, each occurence is made of 3 intervals (ramp up, regular, ramp down) , each of three intervals sharing the same presence
In order to break symmetries, for a given type of plant, the presence of the ith occurence is >= presenceOf(i+1) occurence and rampDown(i) ends before start of rampUp(i+1)
to model the produced power, we cumul on each regular interval between the unit power (eg 2500 for a nuclear plant, 600 for gas, 100 for biomass), and a maximum times the unit power (I set this maximum to 3, 5 and 25 to mimic your data). This cumul function will be constrained to be between 10000 and a bigM value in the presence of a fixed interval of duration 30 days (actually in the model, I use a granularity of half days since there exist a ramp down of 0.5 days for biomass, so every initial duration data is doubled)
To enforce the fact that each occurence produces a multiple of the unit power, I force the height of the cumul function for a given pattern and occurence to be in a set built with the multiples of the unit power supply
An alternative model would be to avoid this variable height and index intervals per pattern, occurence and a "plant index". Then the powerSupply would be more simple since each interval would generate a fixed power supply and we don't need the domain constraint
David
------------------------------
David Gravot
Original Message:
Sent: Thu June 08, 2023 06:28 AM
From: Pierre Chavanne
Subject: Cplex - Python mixed problem Decision-MILP
Hi David,
Many thanks for your response. Initially I decided to split the problem into sizing/scheduling as I am just a beginner in Cplex but your piece of advice sounds interesting.
As I understand your statement, I have to declare all the available power plants as interval variable (?) patterns and the CPO model will cope with scheduling considering constraints and objective. In that way, not all the available p.p. will necessarily be used and it will give an optimal solution by choosing the right patterns at the right moment.
Pierre
------------------------------
Pierre Chavanne
Original Message:
Sent: Tue June 06, 2023 09:54 AM
From: David Gravot
Subject: Cplex - Python mixed problem Decision-MILP
Hi
I understand from your paper that you want/ need (?) to separate the sizing of the plants (how many of each type) before scheduling them (eg covering the demand with plant patterns)
What if you would directly solve the sole scheduling problem ? With CPO, it's possible to model optional intervals so that choosing to use plant patterns can also be decided in the same time as their start/end.
David
------------------------------
David Gravot
Original Message:
Sent: Tue May 30, 2023 07:37 AM
From: Pierre Chavanne
Subject: Cplex - Python mixed problem Decision-MILP
Hello,
I have the following problem I would like to solve as a proof-of-concept to buy a Cplex license afterwards if I find the solution successful.
I would like to find a way in Cplex-Python (mandatory !) to solve the probelm you will find attached. It concerns both a sizing (MILP problem ?) and a scheduling problem (decision problem ?) about power production considering several types of power plants and operating patterns. You will find all details in the attached presentation.
I wrote two naive files to begin the project but I am stuck with this : I do not know how to build the whole function in Cplex-Python in terms of coding (which strcuture, which functions...).
Can you help me (modifying the files, giving hints, etc..) please ?
Thanks a lot.
Pierre
------------------------------
Pierre Chavanne
------------------------------