Peloptimize Package Guide#
- Author
Erik Inqwersen
- Date
February 19, 2024
Welcome to the guide for the peloptimize
package,
a powerful tool designed for minimizing the production costs associated with
the production of pellets through the use of machine learning and
optimization techniques. This document provides an overview of the package,
including its main components and instructions on how to use it effectively.
Overview#
The peloptimize
package, imported under the name wip
, is a comprehensive
Python library. It performs the following macro tasks:
Trains ridge regression models
Solve optimization problems based on historical data and predefined configurations.
Installation#
For instructions on how to install the peloptimize
package, please refer to
the following guide: Installing the peloptimize
Main Modules#
The package consists of several modules, each serving a distinct purpose in the process of training models and solving optimization problems:
wip.mltrainer
: This module is responsible for training ridge regression models for each DataFrame generated during the preprocessing step.wip.otm
: Utilizes the DataFrames with historical data, the trained ridge regression models, and predefined configurations to create and solve optimization problems for each production range.wip.constants
: Contains a set of configurations used during the training of ridge regression models and the creation of optimization problems.wip.files
: Defines lower and upper bounds for various variables of the optimization problems, along with modules containing tags descriptions and mappings between PIMS and PI-SYSTEM nomenclatures.wip.modules
: Handles the creation of constraints, objective function, and outputs for the optimization problems.
Command-Line Commands#
After installing the package, you can execute specific steps through the command line:
run-ml
: Train and save the ridge regression models.run-otm
: Create and solve the optimization problems for each production range.run-all
: A combination ofrun-ml
andrun-otm
, this command trains the ridge regression models and then solves the optimization problems for each production range.
Production Ranges#
The package creates a different optimization problem for each of the following production ranges:
“700-750”
“750-800”
“800-850”
“850-900”
“900-950”
“950-1000”
These ranges correspond to the “PROD_PQ_Y@08US” column values within the specified intervals.
Input Files#
Two main input files are required:
df_sql.joblib
: A pandas DataFrame containing historical data for every tag needed.datasets.joblib
: A dictionary of pandas DataFrames containing the tags each model uses, with the last column always being the target column that the models try to predict.
These files should be stored in the peloptimize/data
folder.
Output Files#
The outputs are stored in specific folders:
Ridge Regression Models Training: Outputs are saved to
peloptimize/outputs/predictive_models
.Optimization Problems Results: Results are stored in
peloptimize/outputs/resultados_modelos_preditivos/us8
.
Basic Usage#
Training Ridge Regression Models#
To train the ridge regression models, you would typically execute the run-ml
command.
While specific Python code examples are not provided in this guide,
the command-line interface (CLI) simplifies this process.
$ run-ml
Solving Optimization Problems#
After training the models, you can solve the optimization problems for each
production range using the run-otm
command.
run-otm