Logic for Problem Description

In the Optimization Engine models, the core of the model is the logic element that triggers the Optimization Engine. It is the place where the optimization problem description is captured. (In the Price Waterfall Accelerator, it is the element Run.groovy in the PW_4_Res_Calc_RunOptimization logic; for details see Technical User Reference.)

This element uses Datamart tables to instantiate the Optimization Engine model and run the optimization. These tables have to be created beforehand, either in the first elements of the same logic as the Run.groovy element or in a previous step of the model. It is recommended to write the code to create the Datamart tables after writing the problem description. For details see .

A typical Run.groovy is composed of three parts:

Inline Variable Definitions

This part is not mandatory. A typical line of code would be:

def min_percentage = libs.PW_Library.Parameters.getDecimalParameter( "Criteria", "MinPercent" ) / 100

This is where the code declares variables called by the description. Typically, in this example, the value provided by a user input parameter is set to min_percentage.

PW_Library is deployed by the Price Waterfall Accelerator and is useful to declare and use the user inputs.

Problem Description

The description is a Groovy map, called problem in the POAI Accelerator Run element. This is the main part of the Run.groovy configuration. The following pages explain how to write it.

def problem = [ "hierarchies": [...], "spaces" : [...] ]

The problem is composed of a hierarchies list and a spaces list. Once this problem structure written, the first step is to define the hierarchies and then the spaces. For details see .

Optimization Engine Run

A typical code to trigger a job on an instantiated Optimization Engine backend is:

def parameters = [ stop_condition: [ max_steps: 500 ], problem : problem ] model.startJobTriggerCalculation( "cregistry.pricefx.eu/engineering/pricefx-optimization-engine", "v2", api.jsonEncode(parameters), "jobName" )

pricefx-optimization-engine access is a prerequisite; see .

The Optimization Engine parameters are the problem description and some running parameters. model.startJobTriggerCalculation reads them in a JSON format and translates the problem description in YAML for the meta-model instantiation. The other job parameters are described in .

Summary

The global Run element architecture is:

Found an issue in documentation? Write to us.

Â