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 hots package, all the Pyomo related work is located in model.py. Pyomo allows us
to create optimization models (see section Process explanation for more details about the optimization
models use), in our case modeling the clustering and the containers placement problem.
We define an abstraction of the optimization model and their use at a higher level, allowing the user to customize the optimization part as he wants, either by providing small changes on optimization models in the same file or bigger changes, like completely different models and / or different use, defined in his own file.
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.py file, all the model definition and creation (described next) are
specified inside a class named Model. All the functions outside this class define how these
models are used.
Optimization models description
In the 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 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 model.py is as follow :
The used placement optimization model is the following :