This is the documentation for Clover Club 12.0.
Documentation for the upcoming version Rampur 13.0 can be found here.

Optimization Company Parameter Tables

When the model is saved for the first time, the Optimization module automatically generates a Model Params [ModelName] Company Parameter table containing model parameters that can be stored and accessed within the logic.

For models with distributed calculation Optimization also generates a ModelCalculation [ModelDLId] Company Parameter table containing the calculation items of the distributed steps.

Additional tables can be created directly in the Optimization logic as necessary. When an Optimization logic needs to create a table but an active table with the same name already exists (for example from the previous run), the new table is created with inactive status. Existing inactive tables with the same name are deleted. Inactive table is not accessible by API functions api.findLookupTable or api.findLookupTableValues but they can be accessed by their ID using model API functions model.readLookupTable and model.writeLookupTable.

Optimization-specific Groovy Bindings

  • lib – Provides access to an Optimization logic with postfix _Lib (see Lib logic).

  • model – Provides access to the ModelFormulaContext (not documented in API Doc).
    Note: The following lists are not exhaustive.

Field

Description

Field

Description

model.def

A dedicated map similar to api.global. This map is stored with the model when saved, deployed or calculated. The map is accessible everywhere throughout the Optimization model logic. The whole ModelFormulaContext is stored as an XML on the Optimization Model so it is not recommended to store large data here.

model.params

Map containing the parameters stored in Model Params Company Parameter table. To set a parameter use the model.setParam method.

model.filterNode

 

model.filterNodeAggregateFilter

 

model.record

A Policy Record currently stored on the model (not persisted).

model.modelRecordAttributeMeta

Specification of Policy Record attributes – column name and display type.

model.attachments

 

model.defaults

Default values for user inputs.

Method

Description

Method

Description

model.setParam(name, value)

Stores parameter with the given name and value in the Model Params Company Parameter table.

model.createJsonLookupTable(tableName, columnNames)

Creates a Company Parameter table tableName with column names defined in columnNames list. Returns the table ID.

model.updateLookupTable(tableID, values) 

Updates the Company Parameter table with the given ID with a list of records, each record represented as a map.

model.calculationStepsEntry(step1, step2, …)

Sets the sub-steps for the Calculation phase (see Calculation step) and returns the current step.

model.addOrUpdateCalcItem(key1, key2, value) 

Creates a calculation item. The key1 parameter must contain the name of the calculation step, the other parameters should contain other information that identifies the item to be processed.

model.deleteCalcItems(key1)

Deletes all calculation items of the given calculation step (key1). Returns the number of deleted items.

model.findCalcItems(key1)

Fetches all calculation items of the given calculation step (key1).

model.getCalcItem()

During a calculation step returns the current calculation item that is being processed.

model.addField(field)

Adds a field to the model’s data model, similarly to adding a field to a Datamart. The field parameter should be a map with standard field attributes: name, label, type, format, dimension, key.

model.modelRecords(filter)

Fetches all policy records of the model according to the given filter.

model.deleteRecords()

Deletes all policy records of the model. Returns the number of deleted items.

model.setRecord(policyRecord)

Stores the given Policy Record (either ModelRecord object or a map) to the model for later access.

model.findRecord(segmentName, date, status)

Finds a policy record with the given segment and workflow status, which is valid on the given date.

model.findRecords(filter, sortBy)

Finds policy records according to the given filter.

model.addRecord(name, timePeriod, attributeMap, fieldFormatMap, calculate)

Creates and stores a new PolicyRecord with the given name, time period and attribute values. If an attribute did not exist before, it is created with a format defined in the fieldFormatMap. A Boolean calculate parameter makes it possible to turn off auto-calculation of a PolicyRecord to improve performance during development.

model.writeLookupTable(tableID, entries)

Writes the entries (a collection of maps) into a Company Parameter table with the given ID.

model.readLookupTable(tableID, filters)

Reads values from a Company Parameter table with the given ID that pass the filter.

model.matrixLookupTableAsMap

Returns the content of a matrix-type Company Parameter table as a map.

model.addTree(name, data, keyCols, labelCols, outputColName, outputColFormat)

Creates a tree with the given name and data in a format of Matrix2D.

model.deleteTree(name)

Deletes the segmentation tree with the given name from the model.

model.getTree(name)

Returns the tree with the given name.

model.evaluateTree(tree, inputMap)

Given a tree and an input map to search by, returns the output column value of a corresponding tree node.