ExplanOptimizer¶
The ExplanOptimizer class sets up the Pyomo optimization model for the QuESt Planning framework, including parameter definitions, variable initialization, constraint population, and solver configuration.
Authors: C. Newlun and W.
Class Reference¶
Attributes¶
- quest_planning.explan.optimizer.data_handler: object = None¶
A data handler object that provides data and configuration settings for the optimizer.
- quest_planning.explan.optimizer.var_index_labels: dict = None¶
Dictionary mapping variable names to their index labels.
- quest_planning.explan.optimizer.par_index_labels: dict = None¶
Dictionary mapping parameter names to their index labels.
- quest_planning.explan.optimizer.index: callable = None¶
Function that resolves index names to data references.
- quest_planning.explan.optimizer.solver: str = 'cbc'¶
The solver to be used for optimization (e.g., cbc, gurobi, HiGHs).
Methods¶
- quest_planning.explan.optimizer.__init__(data_handler, **kwargs)¶
Initializes the ExplanOptimizer with the given data handler and optional solver configuration.
- Parameters:
data_handler – The data handler object for the optimizer.
kwargs – Additional keyword arguments, including solver.
- quest_planning.explan.optimizer._set_model_param()¶
Sets up parameters for the Pyomo optimization model, including definitions for loads, renewable profiles, RPS policies, and generator-specific attributes.
- quest_planning.explan.optimizer._set_model_var()¶
Initializes Pyomo variables for the model, such as generation dispatch, state of charge, renewable curtailments, and power flow.
- quest_planning.explan.optimizer.instantiate_model()¶
Instantiates the Pyomo model, defining its sets, parameters, and constraints.
- quest_planning.explan.optimizer.populate_model()¶
Fully defines the model by setting parameters, variables, and constraints using the ExplanConstraints class.
- quest_planning.explan.optimizer.solve_model()¶
Solves the optimization model using the specified solver. If successful, processes and returns the results.
- Raises:
AssertionError: If the solver fails to find an optimal solution.
- quest_planning.explan.optimizer.print_model_stats()¶
Prints the model size and statistics for diagnostic purposes.
- quest_planning.explan.optimizer._process_results()¶
Processes and organizes model results, including derived quantities of interest and creating results DataFrames.
- quest_planning.explan.optimizer.get_results()¶
Returns model variables, parameters, and the timestamp as results of the optimization.
- Returns:
A tuple containing model variables, parameters, and the timestamp.
- quest_planning.explan.optimizer.get_timestamp()¶
Generates a timestamp for when the model results are retrieved.
- Returns:
A string representing the timestamp.
Detailed Description¶
The ExplanOptimizer class provides a specialized implementation for setting up and solving Pyomo models in the QuESt Planning framework. It interfaces with a data handler to ingest configuration settings and data, then defines the optimization problem based on these inputs. The class includes methods for processing results, generating reports, and providing diagnostics.
API Reference¶
For a detailed reference of all methods, attributes, and inherited properties, refer to the autodoc-generated content below.
QuESt Planning - explan optimizer to set up the Pyomo model Authors: C. Newlun and W. Olis
- class quest_planning.explan.explan_optimizer.ExplanOptimizer(data_handler, **kwargs)[source]
Bases:
Optimizer
- get_results()[source]
A method for returning the results DataFrame plus any other quantities of interest.
- get_timestamp()[source]
- instantiate_model()[source]
A method for instantiating the model and assigning Optimizer attributes to model attributes.
- log_infeasible_constraints()
Logs infeasible constraints from the model.
- property model
Pyomo ConcreteModel.
- populate_model()[source]
A method for setting model parameters, variables, and an ExpressionsBlock object for defining objectives and constraints.
- print_model_stats()[source]
Print model statistics
- property results
A results DataFrame containing series of indices, decision variables, and/or model parameters or derived quantities.
- run()
Instantiates, creates, and solves the optimizer model based on supplied information. Use if no steps are needed between constructing the model and solving it.
- set_model_parameters(**kwargs)
Sets model parameters in kwargs to their respective values.
- solve_model()[source]
Solves the model using the specified solver.
- property solver
The name of the solver for Pyomo to use.