Pyomo use
This page aims to give some useful information about the use of pyomo module in hots.
What is pyomo ?
Pyomo is a Python-based open-source software package that supports a diverse set of optimization capabilities for formulating, solving, and analyzing optimization models. See the Pyomo home page for more information about it.
How is it used ?
In the hots package, Pyomo-based optimization models are implemented in
hots.plugins.optimization.pyomo_model and are instantiated through
hots.plugins.optimization.factory.OptimizationFactory. This plugin
architecture allows hots to support multiple optimization backends
(only Pyomo for now) while keeping the application logic independent from the
concrete modeling library.
The optimization models need a solver to be solved, and the use of Pyomo allows a wide variety of solvers to be used (see here). In hots, this solver is simply indicated in the parameter file (see section User manual).
Inside the pyomo_model.py file, all the model definition and creation (described next) are
specified inside a class named PyomoModel. All the functions outside this class define how these
models are used.
Optimization models description
In the pyomo_model.py provided file, 2 optimization models are created, representing our use case
: the clustering problem and the placement problem.
The process followed in the pyomo_model.py file to build the optimization models is as follow :
Create an Pyomo abstract model to handle your model at a high level
Define the parameters that will help building the abstract model (objects from which variables and constraints will be created)
Define the variables, constraints and objective defining your model (the provided models are shown as examples at the end of this section)
Create data objects that will define the model instance (object from which the data will be taken)
Create a Pyomo instance, instantiating variables, constraints and objective using data objects.
See the Pyomo documentation for more details about all these objects.
Finally, the clustering optimization model provided in the pyomo_model.py is as follow :
The used placement optimization model is the following :