How to optimize multiple times in a run

Hello,

I’m completely new to Julia / JuMP. I’m working on writing least-cost dispatch code for a power system.

I want to load in data for one year (8760 hours), but have the model optimize only one day at a time. What is the best way to do this?

One thought is to set up a model for each 24-hour period, and then execute each model sequentially, such as:
m[1]=Model(Gurobi.Optimizer) #for the first day, and so on

One issue, however, is that some information from the previous day needs to be carried over to the next day (such as the on/off state of the generators, the battery state of charge, etc.). Whatever method used would need to be able to accommodate this…

Thank you in advance for your assistance.

Hi @Anjinsan,

This tutorial should point you in the right direction: Power Systems · JuMP

If it’s only the data that is changing between periods, you can update the model in-place. Otherwise, write a function that takes in the current state of the system, formulates and solves a problem, and then returns the new state of the system.

You should also check out other projects like https://github.com/NREL-SIIP/PowerSimulations.jl and https://github.com/NREL-SIIP/PowerSystems.jl. They already have a lot of tooling to help solve least-cost dispatch problems, along with a range of other things.

Here’s a tutorial to get started:
https://nrel-siip.github.io/PowerSystems.jl/stable/modeler_guide/generated_modeling_with_JuMP/

Shameless plug, if you would like an example of building single time point OPF-like models in JuMP, examples are available here,

https://github.com/lanl-ansi/PowerModelsAnnex.jl/tree/master/src/model

1 Like

@odow Thank you for your thorough response.

@odow
Could you please clarify what you mean by “updating the model in-place?”

In this case, I am using some of the results of the last optimization to inform the start of the next optimization. I’m simply creating a constraint that one of the starting values of the next run must equal the ending value of the last run. I’m not using set_start_value. (Should I be?)

Thanks again,
Jim