Query Optimization Engine Results
To query Optimization Engine results, you have three options:
Using an Evaluator
An evaluation logic is used to access model results from outside of the model itself, for example in another module. The evaluation logics are defined in the Model Class:
{
"uniqueName": "My Model Name",
"definition": {
"evaluations": [
{
"name": "query_model",
"formulaName": "My_Eval_Query"
}
],
"calculations": [ // definition of the calculations
],
"steps": [ // definition of the steps
]
}
}
To query the evaluation, the first step is to use api.model("ModelName")
to get the model and then use the method evaluate
on it to retrieve an answer based on the given parameters. The code needed to get these results is :
def model = api.model("TheModelUniqueName")
def results = model.evaluate(
“query_model”, // the name specified for the evaluation in the MC
[
input1: "someProductID", // key depends on the evaluation logic inputs
//...
]).results
def unitNetPrice = results['unit_net_price']
The accepted inputs and the corresponding returned results may change, depending on the evaluation logic.
Using Analytics Data Analyzer
By default, the optimization engine creates some tables inside the model. They are:
Glassbox
Result tables
Solution tables
Simulation tables
Moreover, it is possible to create other tables by logics. All the tables are accessible inside the model, using the top right corner button.
The glassbox is a tool to explain how the optimization engine reached its state. It is detailed in Explainability (Glassbox) (Pricefx employees only).
The other tables expose the values after optimization.
Result tables provide the criteria values and states. Their names are
Result_<Name of the space>_<Name of the criterion>
.Solution tables provide the value finders values and states. Their names are
Solution_<Name of the space>_<Name of the value finder>
.Simulation tables the values of the computed variables, only if the computed variable was marked as exposed in the problem description. Their names are
Simulation_<Name of the space>_<Name of the variable>
.
Fetching the Model Tables
All the model tables described above are accessible from outside of the model itself. It is a way to fetch specific model data from any place in Pricefx. The commands are:
def myModel = api.model("TheModelUniqueName")
def myTable = myModel.table("TheTableName")
Found an issue in documentation? Write to us.