MultiStage Approach for Upper and Lower Bounds¶
Descriptions of the basic functions are given below.
Function descriptions:
Last edited: February 20, 2020
@author: FINE Developer Team (FZJ IEK3)

optimizeTSAmultiStage.
optimizeTSAmultiStage
(esM, declaresOptimizationProblem=True, relaxIsBuiltBinary=False, numberOfTypicalPeriods=30, numberOfTimeStepsPerPeriod=24, clusterMethod='hierarchical', logFileName='', threads=3, solver='gurobi', timeLimit=None, optimizationSpecs='', warmstart=False)[source]¶ Call the optimize function for a temporally aggregated MILP (so the model has to include hasIsBuiltBinaryVariables in all or some components). Fix the binary variables and run it again without temporal aggregation. Furthermore, a LP with relaxed binary variables can be solved to obtain both, an upper and lower bound for the fully resolved MILP.
Required arguments:
Parameters: esM (EnergySystemModel instance from the FINE package) – energy system model to which the component should be added. Used for unit checks. Default arguments:
Parameters:  declaresOptimizationProblem (boolean) – states if the optimization problem should be declared (True) or not (False).
(a) If true, the declareOptimizationProblem function is called and a pyomo ConcreteModel instance is built.
(b) If false a previously declared pyomo ConcreteModel instance is used.
* the default value is True  relaxIsBuiltBinary – states if the optimization problem should be solved as a relaxed LP to get the lower
bound of the problem.
* the default value is False  numberOfTypicalPeriods (strictly positive integer) – states the number of typical periods into which the time series data
should be clustered. The number of time steps per period must be an integer multiple of the total
number of considered time steps in the energy system.
Note: Please refer to the tsam package documentation of the parameter noTypicalPeriods for more
information.
* the default value is 30  numberOfTimeStepsPerPeriod (strictly positive integer) – states the number of time steps per period
* the default value is 24  clusterMethod (string) – states the method which is used in the tsam package for clustering the time series
data. Options are for example ‘averaging’,’k_means’,’exact k_medoid’ or ‘hierarchical’.
Note: Please refer to the tsam package documentation of the parameter clusterMethod for more information.
* the default value is ‘hierarchical’  logFileName (string) – logFileName is used for naming the log file of the optimization solver output
if gurobi is used as the optimization solver.
If the logFileName is given as an absolute path (e.g. logFileName = os.path.join(os.getcwd(),
‘Results’, ‘logFileName.txt’)) the log file will be stored in the specified directory. Otherwise,
it will be stored by default in the directory where the executing python script is called.
* the default value is ‘job’  threads (positive integer) – number of computational threads used for solving the optimization (solver dependent
input) if gurobi is used as the solver. A value of 0 results in using all available threads. If
a value larger than the available number of threads are chosen, the value will reset to the maximum
number of threads.
* the default value is 3  solver (string) – specifies which solver should solve the optimization problem (which of course has to be
installed on the machine on which the model is run).
* the default value is ‘gurobi’  timeLimit (string) – if not specified as None, indicates the maximum solve time of the optimization problem
in seconds (solver dependent input). The use of this parameter is suggested when running models in
runtime restricted environments (such as clusters with job submission systems). If the runtime
limitation is triggered before an optimal solution is available, the best solution obtained up
until then (if available) is processed.
* the default value is None  optimizationSpecs – specifies parameters for the optimization solver (see the respective solver
documentation for more information). Example: ‘LogToConsole=1 OptimalityTol=1e6’
* the default value is an empty string (‘’)  warmstart (boolean) – specifies if a warm start of the optimization should be considered
(not always supported by the solvers).
* the default value is False
Last edited: February 20, 2020
@author: FINE Developer Team (FZJ IEK3) declaresOptimizationProblem (boolean) – states if the optimization problem should be declared (True) or not (False).
(a) If true, the declareOptimizationProblem function is called and a pyomo ConcreteModel instance is built.
(b) If false a previously declared pyomo ConcreteModel instance is used.

optimizeTSAmultiStage.
fixBinaryVariables
(esM)[source]¶ ” Search for the optimized binary variables and set them as fixed.
Parameters: esM (EnergySystemModel instance from the FINE package) – energy system model to which the component should be added. Used for unit checks. Last edited: February 20, 2020
@author: FINE Developer Team (FZJ IEK3)