Introduction to RASON
About RASON Models and the RASON Server
Rason Subscriptions
Rason Web IDE
Creating and Running a Decision Flow
Defining Your Optimization Model
Defining Your Simulation Model
Performing Sensitivity Analysis
Defining Your Stochastic Optimization Model
Defining Your Data Science Model
Defining Custom Types
Defining Custom Functions
Defining Your Decision Table
Defining Contexts
Using the REST API
REST API Quick Call Endpoints
REST API Endpoints
Decision Flow REST API Endpoints
OData Endpoints
OData Service for Decision Flows
Creating Your Own Application
Using Arrays, For, Loops and Tables
Organization Accounts

The Basic Model

An easily understood way to formulate this model (though not necessarily the best way to formulate the model), can be found below.



{
 modelName: "BasicLinearModel", 
 modelType: "optimization",
 variables: {
    x: {lower: [0, 0, 0], finalValue: [] }
 },
 constraints: { 
    chassisUsed: { formula: "x[1] * 1 + x[2] * 1 + x[3] * 0", upper: 450 },
    screensUsed: { formula: "x[1] * 1 + x[2] * 0 + x[3] * 0", upper: 250 },
    speakersUsed: { formula: "x[1] * 2 + x[2] * 2 + x[3] * 1", upper: 800 }, 
    powerUsed: { formula: "x[1] * 1 + x[2] * 1 + x[3] * 0",upper: 450 },
	electronicsUsed: { formula: "x[1] * 2 + x[2] * 1 + x[3] * 1",upper: 600}
 },
 objective: {
    obj: { type: "maximize", formula: "x[1] * 75 + x[2] * 50 + x[3] * 35", finalValue: []}
 }
}

The RASON model beings with the modelName, which names the model "BasicLinearModel". In variables, a column array x of size 3 is defined (x[1], x[2] and x[3]) to hold the number of products to produce. These are our decision variables. The dimensions of an array can be explicitly defined by the dimensions property. However, in the absence of the dimensions property (as in this example), the value property implicitly defines the shape of the array as a column vector with 3 rows. The empty array, finalValue[] tells the RASON system that we want the results from solving to include the final values of each variable.

The 5 constraints are calculated in Constraints by multiplying the decision variables (x[1], x[2] and x[3]) by the number of parts required for each product as shown in our algebraic form (above). The number of parts used must be less than or equal to the number of parts in inventory, so the upper bound for our first constraint is: x[1] * 1 + x[2] * 1 + x[3] * 0 <= 450. The other constraints are similar.

In objective, we must multiply the number of products to produce by the profit of each product using the formula: "x[1] * 75 + x[2] * 50 + x[3] * 35". Since we want to maximize profit, we set type to maximize and ask for the final value of the function in the results.

This model works well for the business situation initially described, with exactly three products and five types of parts but it's not very flexible. What if more products were added and more parts were required? In the next section, we'll begin to generalize this model so it can handle different numbers of products and parts.

Back to Algebraic Form