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 GitHub - NREL-SIIP/PowerSimulations.jl: Julia for optimization simulation and modeling of PowerSystems. Part of the Scalable Integrated Infrastructure Planning Initiative at the National Renewable Energy Lab. and GitHub - NREL-SIIP/PowerSystems.jl: Data structures in Julia to enable power systems analysis. Part of the Scalable Integrated Infrastructure Planning Initiative at the National Renewable Energy Lab.. 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,

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