## Designing Analytic Type Definitions

This chapter provides overviews of analytic type definitions and optimization application record design and discusses how to:

• Create and build optimization records.

• Create analytic type definitions.

• Run the optimization system audit.

• Change existing analytic type definitions.

### Understanding Analytic Type Definitions

An analytic type definition groups the optimization application records, the optimization transactions, and the Optimization plug-in (OPI) together as one entity. The optimization application records contain the data stored in the database. The data is populated into memory in the optimization engine. The optimization transactions define the interface between the application server and the OPI, which performs the optimization computation. Use PeopleSoft Application Designer to create the analytic type definition for an optimization application.

An Optimization Problem Example

To illustrate the steps of creating an optimization-based application, consider the following example: Create an optimal exercise schedule that makes use of exercise machine availability and satisfies individuals' exercise preferences. To create an optimization application for this problem, you need input data about:

• Exercises that burn a set number of calories per minute.

• People who know how long they want to exercise and how many calories they want to burn.

The goal of your application is to generate a list containing an exercise and the duration of exercise appropriate to each person, based on the input data.

To implement the analytic type definition for this example, you would:

1. Create and populate a set of records containing the input data about the exercises and the participants.

These are the optimization application records for this application.

2. Define a set of optimization transactions and their parameters that, when implemented, process the optimization application records to achieve the goal.

Note. For this example, assume that an OPI (QEOPT.DLL) already exists that implements these transactions.

### Understanding Optimization Application Record Design

This section discusses:

• Optimization application records.

• Scenario management.

#### Optimization Application Records

You use PeopleSoft Application Designer to design optimization application records to contain source data, result data, and other data. You also decide how the optimization engine uses these records for synchronization. For each record that you create, decide:

• Which data fields the record should contain.

Among other data, these records contain the data from the PeopleSoft application database that is used in the optimization process.

• How the optimization engine uses the record for synchronization.

If the record is read once, the optimization engine reads this data during the initial load only. If the record is readable, the optimization engine checks for updates with every optimization transaction. If the record is writable, the optimization engine is allowed to modify the data in the database. All records except read-once records must have a VERSION field.

• Whether the record should be scenario-managed.

A record should be scenario-managed if it contains data pertaining to multiple analytic instances. Such records must have a PROBINST key field, which the optimization engine uses as an additional key for storing and retrieving multiple solutions.

#### Scenario Management

In PeopleSoft Optimization Framework, scenario management is the mechanism to manage different source and result data sets using the same tables. A set of source data and associated result data is called an analytic instance. You can break down large optimization problems into smaller, more manageable problems (or analytic instances) that can each be solved independently. Individual analytic instances can share common data.

This concept can be extended to what-if scenarios to plan for potential business situations. Separate analytic instances can be created with what-if data and solved using optimization separately, without fear of affecting live data.

In terms of the exercise example, any number of people might want exercise schedules using the optimization application. Exercise goal data and the optimization-generated exercise schedule data are unique to each person. However, different people share the same set of exercise machines. In this case, it is logical to treat the generation of an individual person's exercise schedule as a separate analytic instance.

In the exercise example, you would mark the data that is specific to each person (such as exercise goals and exercise schedules) as scenario-managed, and the data that is shared by all people (such as exercise machines) as nonscenario-managed. All scenario-managed records must include the PROBINST field as part of the primary key. This 20-character field identifies data that is specific to an analytic instance. During runtime, the optimization engine loads data for scenario-managed records based on the user-specified value for the PROBINST field. At any moment, the optimization engine contains data for only one analytic instance.

The following record, QE_ROSM_BIODATA, contains the name of a person who exercises, and physical data about the person. This record is read once and is scenario-managed. Notice the use of the PROBINST field:

QE_ROSM_BIODATA record

### Creating and Building Optimization Records

To create and build optimization application records:

1. Create the optimization application record definitions using PeopleSoft Application Designer.

1. Select Start, Programs, PeopleSoft 8.xx, Application Designer.

2. Enter your signon information, and click the OK button.

The Application Designer window appears.

3. Select File, New from the tool menu.

4. Select the Record option, and click the OK button.

2. For every optimization application record that is readable, create an optimization delete record by cloning the optimization application record.

Clone the record by performing a Save As operation on the optimization application record and renaming the optimization delete record to be similar to the original optimization application record. Use a naming convention for all optimization delete records. For example, the optimization delete record for the record QE_R_HOLIDAYS might be named QE_R_HOLIDAYDEL.

Alternatively, use a sub-record definition that is shared by the optimization application record and the delete record.

Note. Oracle strongly recommends that you keep the optimization application record and its associated optimization delete record in sync with each other.

3. For every optimization application record that is readable, associate that record with its optimization delete record using the these steps:

1. In PeopleSoft Application Designer, open the optimization application record.

2. Select File, Definition Properties.

3. Select the Use tab in the Record Properties dialog box.

4. Enter the name of the optimization delete record in the Optimization Delete Record field.

4. Open (or create) a project and insert all the optimization application records and optimization delete records into the project.

5. Create the tables from these records.

1. Select Build, Project.

The Build dialog box appears, showing the optimization application records and optimization delete records in the project.

2. Select the Create Tables check box, and make sure that the Create Triggers check box is clear.

3. Click the Build button.

6. Create optimization database triggers from these records.

1. Select Build, Project.

The Build page appears, showing the optimization application records and optimization delete records in the project.

2. Select the Create Triggers check box.

3. Click the Build button.

Note. Optimization delete records can be used by several analytic types. When a record is deleted from an analytic type, the associated delete record is not needed if this record is not used elsewhere.

### Creating Analytic Type Definitions

This section discusses how to:

• Define an analytic type.

• Configure analytic type records.

• Configure models for optimization.

• Associate Analytic Types with Analytic Models.

Note. When working with analytic type definitions, you can use the typical drag-and-drop features offered by PeopleSoft Application Designer. For example, you can drag record definitions and drop them into the analytic type record list, which is maintained on the Record tab of the analytic type definition.

#### Defining an Analytic Type

In PeopleSoft Application Designer, select File, New, Analytic Type. A new analytic type definition appears, containing tabs for transactions, records, and models. The definition combines these items with an OPI to form the basis of an optimization application.

This is an example of the analytic type definition:

To complete the analytic type definition, you should configure the analytic type properties, then insert and configure the records, the optimization models, and the transactions, in that order.

To access the Analytic Type Properties – Attributes dialog:

1. From the Analytic Type – Transaction tab, select File, Definition Properties.

2. Select the Attributes tab.

This is an example of the Analytic Type Properties – Attributes tab:

 PeopleCode Plugin Select to indicate that the analytic type should use the Optimization PeopleCode plug-in. Select this check box only if the analytic type is to be used with optimization. If the analytic type is to be used with the analytic calculation engine, do not select this check box. Psopidplugin is automatically entered in the Plugin Library Name field, which is read-only. If you use this plug-in, you must also use the Package and Class fields to specify an application class that was developed to adapt the Optimization PeopleCode plug-in to your optimization application. See Invoking the Optimization PeopleCode Plug-In Invoking the Optimization PeopleCode Plug-In. Plugin Library Name Enter the name of the OPI library. Enter only the portion of the name that is specific to this library. Ignore operating system-specific prefixes (such as lib) and suffixes (such as .dll). In the exercise example, in Microsoft Windows, the library is libqeopt.dll. You would enter only qeopt here. If you selected the PeopleCode Plugin check box, this field contains the value psopidplugin, and is read-only. Plugin Library Version Enter the application release version of the plug-in. The optimization engine uses this to confirm that the correct version of the plug-in library is used at runtime. Message Set ID Enter the message set ID in the message catalog containing the messages for the optimization application. The OPI uses this to access messages from the message catalog. Plugin Application Class – Package If you selected the PeopleCode Plugin check box, you must specify here the application package containing the application class to use with the Optimization PeopleCode plug-in for your optimization application. Plugin Application Class – Class If you selected the PeopleCode Plugin check box, you must specify here the application class containing the optimization PeopleCode program to use with the Optimization PeopleCode plug-in for your optimization application. This class must be a subclass of the PT_OPT_BASE:OptBase application class. Analytic Instance Application Class – Package If this analytic type is to be used with the PeopleSoft Analytic Calculation Engine, specify the application package name to associate with this analytic type, that contains the functionality to be used with the analytic type when it is created, deleted, or copied. See Creating, Deleting, and Copying Analytic Instances. Analytic Instance Application Class – Class If this analytic type is to be used with the PeopleSoft Analytic Calculation Engine, specify the name of the class in the application package that contains the Create, Copy, and Delete classes.

Optimization PeopleCode

PeopleTools 8.51 PeopleBook: PeopleSoft Application Designer Developer's Guide

#### Configuring Analytic Type Records

To configure analytic type records, in the analytic type definition, select the Record tab, and then select Insert, Record.

The Analytic Type Record Property dialog box appears as shown:

Note. You can access the properties of an existing analytic type record by right-clicking the record and selecting the Analytic Type Record Properties option.

#### Configuring Models for Optimization

You need to specify and configure analytic type models for optimization only if both of the following conditions are true:

• You selected the PeopleCode Plugin check box in the analytic type properties, indicating that your analytic type definition should use the Optimization PeopleCode plug-in.

• Your application documentation indicates that an optimization model is necessary for the optimization application you are developing.

In the analytic type definition, select the Models tab, and then select Insert, Optimization Model.

The Analytic Type Optimization Model Property dialog box appears.

Note. Your application documentation discusses which models to specify, and what configuration settings to make for each model. You can access the properties of an existing analytic type model by right-clicking the model and selecting the Analytic Type Model Properties option.

 Model Name Select the optimization model required to implement an optimization application with this analytic type. Solver Settings A solver setting is a collection of solver parameters with default values that define a particular solver behavior suitable for the optimization model. Specify one or more solver settings to make available to your optimization application, including: Solver Setting. Enter the name of the solver setting. Solver Type. Select the solver type: LP (linear programming), MIP (mixed integer programming), or LPMIP (both). Active. Select the active solver setting. Only one solver setting can be active at a time.

Configuring Solver Parameters

For each solver setting that you specify, you can configure one or more solver parameters.

In the Analytic Type Optimization Model Properties dialog box, double-click a solver setting to access the Analytic Type Optimization Solver Property dialog box. This dialog box has a grid with two columns: Parameter ID and Parameter Value:

Each solver type has a different set of available parameters, and each parameter has a default value. When you select a solver parameter from the Parameter ID drop-down list box, its default value appears in the Parameter Value cell, and a new row appears for adding another parameter. Your application documentation discusses which parameters to specify for each solver setting, and what value to specify for each parameter.

Creating Mathematical Formulation Files

In addition to the analytic server log files, you can also create a mathematical formulation file for debugging. This file is written in either MPS or LP format and can be requested for technical debugging purposes. The file type is generally LP; however, if the system cannot create an LP file it creates an MPS file. The filename is either AnalyticType_AnalyticInst.LP or AnalyticType_AnalyticInst.MPS, with AnalyticType being the name of the analytic type and AnalyticInst being the name of the analytic instance ID. This file is generally written to the same directory as the application server log. Also, this directory can be configured in the application server configuration file.

You indicate whether to write this file by specifying a solver parameter.

In the Analytic Type Optimization Model Properties dialog box, double-click a solver setting to access the Analytic Type Optimization Solver Property dialog box. This dialog box has a grid with two columns: Parameter ID and Parameter Value.

Select the WriteMPS option for Parameter ID. In the Parameter Value column, enter 1 to write the file or 0 to not write the file.

#### Associating Analytic Types with Analytic Models

For PeopleSoft Analytic Calculation Engine, you only need to associate an analytic type with an analytic mode.

In the analytic type definition, select the Models tab, and then select Insert, Analytic Model.

The Analytic Type Analytic Model Property dialog box appears, as shown:

Select the name of the analytic model that you want to associate with the analytic type. If you specify to add all the records and fields that are used in the model, they are automatically added to the records on the Records tab.

#### Configuring Analytic Type Transactions

In the analytic type definition, select the Transactions tab, and then select Insert, Transaction.

The Analytic Type Transaction Property dialog box appears, as shown:

Note. You can access the properties of an existing analytic type transaction by right-clicking the transaction and selecting the Analytic Type Transaction Properties. option.

 Transaction Name Enter the case-sensitive name of the transaction. If the PeopleCode Plugin check box is selected in the analytic type properties, this value must match the name of a method defined in the application class that you specified for this analytic type. If the PeopleCode Plugin check box is not selected in the analytic type properties, this value must match the name of a service defined in the OPI that you selected in the analytic type properties. The transaction name that you specify must be distinct within an analytic type. For the exercise machine example, three transactions are needed. The QEOPT.DLL OPI implements these transactions: SOLVE solves the exercise machine problem. GET_SUMMARY produces a summary of exercises for a person. IS_MACHINE_AVAILABLE returns whether an exercise machine is available for a specified time. The transaction name can contain up to 30 characters. See OptBase Application Class. Lock Flag Select this option to prevent changes to the optimization application tables while this transaction runs. Typically, this flag should be set for extremely fast but critical transactions where data integrity is crucial. In the exercise planning example, optimization transactions do not need the lock flag. Important! The lock flag can hamper performance, so use it with caution.

Parameter Attributes

Each transaction can have any number of parameters.

If the application class method corresponding to this transaction has parameters, you must define a row in this grid with equivalent attributes for each of the parameters.

 Name Enter the name of the parameter. The name must match the transaction parameter name defined in the OPI, or the equivalent method parameter defined in the application class that you specified for this analytic type. The transaction parameter name can contain up to 20 characters, and it must be distinct within an analytic type. Type Select the parameter type (String, Integer, Double, Date, DateTime, Time, or arrays of these types, or Record Array). The type must match the transaction parameter type defined in the OPI, or the equivalent method parameter type defined in the application class that you specified for this analytic type. Note. Do not pass an array of type Integer as a transaction parameter. Use an array of type Number instead. Input/Output Select Input, Output, or Both. Attributes Select Required, Optional, or Default (the parameter has a default value). This is not applicable to output parameters. Note. If an input parameter is required, it must be supplied when you use either the RunSynch or RunAsynch PeopleCode methods. Value If the Attributes field is set to Default, enter a default value for this parameter. If the type is Record Array, enter the name of the record. Otherwise, leave this blank.

### Running the Optimization System Audit

After you have created the analytic type definition, run SYSAUDIT with the optimization options selected. This ensures that the definition is valid and consistent.

To run the optimization system audit in the PeopleSoft application:

1. Select PeopleTools, Utilities, Audit, Perform System Audit.

2. Enter a run control ID.

3. On the System Audit page, select the Audit Optimization Integrity check box, and click the Run button.

4. On the Process Scheduler Request page, ensure that the System Audit check box is selected, select a server name, and click the OK button.

5. When the System Audit page reappears, click the Process Monitor link (to the left of the Run button).

6. On the Process List page, at the end of the line for SYSAUDIT, click the Details link.

7. On the Process Detail page, click the View Log/Trace link.

8. On the View Log/Trace page, click the SYSAUDIT_XX file name.

This file contains the audit report for your optimization.

Running SYSAUDIT

### Changing Existing Analytic Type Definitions

This section discusses how to change:

• Optimization application records.

• Optimization transactions.

#### Changing Optimization Application Records

To change optimization application records in an analytic type definition:

1. Shut down all the running optimization engines that use this analytic type definition.

2. Shut down other optimization engines if record definitions are being shared by other analytic type definitions.

3. Delete all existing analytic instances using the DeleteOptProbInst PeopleCode function.

See DeleteOptProbInst DeleteOptProbInst.

4. Empty the optimization application tables.

5. Make record definition changes and build the records in PeopleSoft Application Designer.

See Creating and Building Optimization Records.

6. Open the analytic type in PeopleSoft Application Designer, insert any new records or make appropriate changes to reflect changed record definitions, and save the analytic type.

Run SYSAUDIT with the optimization options selected.

Skip the steps about inserting transactions.

7. Change the OPI to reflect the changes to optimization application records.

If the records do not match the plug-in, the program will fail.

8. Call the InsertOptProbInst PeopleCode function to re-create analytic instances.

See InsertOptProbInst InsertOptProbInst.

#### Changing Optimization Transactions

To change optimization transactions in an analytic type definition:

1. Shut down all the running optimization engines that use the analytic type definition.

2. Open the analytic type definition in PeopleSoft Application Designer, insert any new transactions or make appropriate changes to existing ones, and save the analytic type.

Skip the steps about inserting records.

3. Change the OPI to reflect the changes to optimization transactions.

4. Change optimization PeopleCode to reflect the changes (add, remove, and update parameters).

An optimization engine is an instance of an analytic server.

You can use the Analytic Server Administration – Analytic Domain Summary page to administer all optimization engines. To access the Analytic Server Administration – Analytic Domain Summary page from PIA, select PeopleTools, Utilities, Administration, Analytic Server Administration.

See Managing Analytic Servers.

#### Setting Up Integration Broker

Before you can use lights-out mode and other optimization features, you must first configure PeopleSoft Integration Broker for basic messaging.

The only PeopleSoft Integration Broker elements that are specific to optimization engine administration are two transactions delivered with your PeopleSoft application. One transaction is type InSync, the other is type OutSync, and both use the OPT_CALL message. Ensure that they are both active on the Transactions page of the default local node definition.

See Getting Started with PeopleSoft Integration Broker.

Use the Administer License page to update a solver software license. PeopleSoft Optimization Framework uses third-party solver software. In some cases, the solver software is activated by a license.

Note. Currently, no optimization application requires updating the solver license. You should update solver licenses only on instructions from PeopleSoft.