constants#

Define variables needed to run the application.

This module also defines the limits dictionary, that uses the limits_file to define the optimization problem boundaries.

The limits dictionary defines the boundaries and operators for each constraint that’s generated using the regression model coefficients and intercepts.

Notes

  • The limits dictionary defines the operators for some constraints as "LT" (less than), "GT" (greater than). These operators, however, aren’t supported by PuLP, and are replaced by "LTE" (less than or equal to) and "GTE" (greater than or equal to) respectively. This replacement isn’t clearly stated in the code and is performed by some obscure function.

class wip.constants.Constants[source]#

Bases: object

Define optimization problem constants

INVERSE_TARGETS_IN_MODEL = {'GRAN PR': 'GRAN_-0,045_PR_L@08FI', 'SE PP': 'SUP_SE_PP_L@08PR', 'SE PR': 'SUP_SE_PR_L@08FI', 'abrasao': 'ABRA_-0,5_PQ_L@08QU', 'basicidade': 'QUIM_BAS2_PQ_L@08QU', 'cfix': 'QUIM_CFIX_PP_L@08PR', 'compressao': 'COMP_MCOMP_PQ_L@08QU', 'energia_forno': 'CONS ESP VENT TOTAL - US8', 'energia_moinho': 'Consumo de Energia (base minério úmido) kWh/ton', 'energia_prensa': 'CONS EE PRENSA - US8', 'finos': 'TAXA1_Y@08PN-TR-860I-09M1', 'floticor': 'floticor', 'gas': 'VAZA3_I@08QU-ST-855I-01', 'particulados1': 'PARTIC_I@08QU-CH-854I-01', 'particulados2': 'PARTIC_I@08QU-CH-854I-02', 'particulados3': 'PARTIC_I@08QU-CH-854I-03', 'relacao gran': 'rel_gran', 'rota_disco_1': 'GRAN_OCS_TM@08PE-BD-840I-01', 'rota_disco_10': 'GRAN_OCS_TM@08PE-BD-840I-10', 'rota_disco_11': 'GRAN_OCS_TM@08PE-BD-840I-11', 'rota_disco_12': 'GRAN_OCS_TM@08PE-BD-840I-12', 'rota_disco_2': 'GRAN_OCS_TM@08PE-BD-840I-02', 'rota_disco_3': 'GRAN_OCS_TM@08PE-BD-840I-03', 'rota_disco_4': 'GRAN_OCS_TM@08PE-BD-840I-04', 'rota_disco_5': 'GRAN_OCS_TM@08PE-BD-840I-05', 'rota_disco_6': 'GRAN_OCS_TM@08PE-BD-840I-06', 'rota_disco_7': 'GRAN_OCS_TM@08PE-BD-840I-07', 'rota_disco_8': 'GRAN_OCS_TM@08PE-BD-840I-08', 'rota_disco_9': 'GRAN_OCS_TM@08PE-BD-840I-09', 'taxarp': 'RETO1_Y@08PE', 'temp_forno': 'Media_temp', 'temp_recirc': 'TEMP1_I@08QU-HO-851I-01', 'umidade': 'CONS1_Y@08FI-BV-827I'}#
LIMITS = {'GRAN PR': None, 'SE PR': None, 'SUP_SE_PP': None, 'abrasao': None, 'basicidade': None, 'cfix': None, 'compressao': None, 'custo_GRAN PR': None, 'custo_SE PP': None, 'custo_SE PR': None, 'custo_abrasao': None, 'custo_compressao': None, 'custo_distribuicao gran': None, 'dens_moinho_1': None, 'dens_moinho_2': None, 'dens_moinho_3': None, 'distribuicao gran': None, 'energia_forno': None, 'energia_moinho': None, 'energia_prensa': None, 'finos': None, 'gas': None, 'particulados1': None, 'particulados2': None, 'particulados3': None, 'produtividade filtragem': None, 'relacao gran': None, 'taxarp': None, 'temp_forno': None, 'temp_precipitador': None, 'temp_recirc': None, 'umidade': None}#
OBJ_FUNC_COEF = ['antracito', 'bentonita', 'floticor', 'calcario', 'corpo_moedor_especifico', 'energia_forno', 'energia_moinho', 'energia_prensa', 'gas', 'umidade']#
TARGETS_IN_MODEL = {'ABRA_-0,5_PQ_L@08QU': 'abrasao', 'COMP_MCOMP_PQ_L@08QU': 'compressao', 'CONS EE PRENSA - US8': 'energia_prensa', 'CONS ESP VENT TOTAL - US8': 'energia_forno', 'CONS1_Y@08FI-BV-827I': 'umidade', 'Consumo de Energia (base minério úmido) kWh/ton': 'energia_moinho', 'GRAN_-0,045_PR_L@08FI': 'GRAN PR', 'GRAN_OCS_TM@08PE-BD-840I-01': 'rota_disco_1', 'GRAN_OCS_TM@08PE-BD-840I-02': 'rota_disco_2', 'GRAN_OCS_TM@08PE-BD-840I-03': 'rota_disco_3', 'GRAN_OCS_TM@08PE-BD-840I-04': 'rota_disco_4', 'GRAN_OCS_TM@08PE-BD-840I-05': 'rota_disco_5', 'GRAN_OCS_TM@08PE-BD-840I-06': 'rota_disco_6', 'GRAN_OCS_TM@08PE-BD-840I-07': 'rota_disco_7', 'GRAN_OCS_TM@08PE-BD-840I-08': 'rota_disco_8', 'GRAN_OCS_TM@08PE-BD-840I-09': 'rota_disco_9', 'GRAN_OCS_TM@08PE-BD-840I-10': 'rota_disco_10', 'GRAN_OCS_TM@08PE-BD-840I-11': 'rota_disco_11', 'GRAN_OCS_TM@08PE-BD-840I-12': 'rota_disco_12', 'Media_temp': 'temp_forno', 'PARTIC_I@08QU-CH-854I-01': 'particulados1', 'PARTIC_I@08QU-CH-854I-02': 'particulados2', 'PARTIC_I@08QU-CH-854I-03': 'particulados3', 'QUIM_BAS2_PQ_L@08QU': 'basicidade', 'QUIM_CFIX_PP_L@08PR': 'cfix', 'RETO1_Y@08PE': 'taxarp', 'SUP_SE_PP_L@08PR': 'SE PP', 'SUP_SE_PR_L@08FI': 'SE PR', 'TAXA1_Y@08PN-TR-860I-09M1': 'finos', 'TEMP1_I@08QU-HO-851I-01': 'temp_recirc', 'VAZA3_I@08QU-ST-855I-01': 'gas', 'floticor': 'floticor', 'rel_gran': 'relacao gran'}#
production_range = [(700, 750), (750, 800), (800, 850), (850, 900), (900, 950), (950, 1000)]#
tags_to_scale = ['compressao', 'particulados1', 'particulados2', 'particulados3', 'custo_compressao']#
wip.constants._additional_features(_limits: dict) dict[source]#

Add additional features to the optimization problem boundaries.

Parameters

_limits (dict) – Dictionary with limit names as keys and either None or some iterable of two elements as values.

Returns

Dictionary with the additional features added.

Return type

Dict[str, Tuple[str, float]]

wip.constants._read_limits(_limits)[source]#

Process the input dictionary into a suitable format for further use.

This static method reads a dictionary where the keys are limit names, and the values are either None or some iterable with two elements. If the value isn’t None, it gets converted into a tuple; otherwise, it remains None.

Parameters

_limits (dict) – Dictionary with limit names as keys and either None or some iterable of two elements as values.

Returns

Processed dictionary where the values have been converted into tuples if they were not None.

Return type

dict

Notes

This method is designed to be used internally by the class, hence the underscore (_) prefix in the method name.

Examples

>>> _read_limits({'x': [1, 2], 'y': None})
{'x': (1, 2), 'y': None}
wip.constants._scaling_limits(_limits, tags)[source]#

Normalize tag values using np.log.

Parameters
  • _limits (dict) – Dictionary with the optimization problem boundaries.

  • tags (List[str]) – List of tags to normalize.

wip.constants.define_targets(datasets: Dict[str, DataFrame]) List[str][source]#

Return list of values to consider as the model’s targets.

The Method assumes that the last column of each dataframe from :param:`datasets` as the target.

Parameters

datasets (Dict[str, pd.DataFrame]) – Dictionary with the datasets to retrieve the targets from.

Returns

The list of target column names.

Return type

list