About RASON Models and the RASON Server

RASON® is a mini-language you can use to quickly and easily create and solve analytic models -- optimization and simulation/risk analysis models, including data mining and predictive analytics models. You can use RASON tools on Windows and Linux desktops and servers, but the RASON service is especially useful if you are building web or mobile applications, and you’re familiar with RESTful web services. Read about our REST API here.

RASON stands for RESTful Analytic Solver® Object Notation. It offers many benefits compared to using a traditional modeling language, using Excel to create analytic models, or writing analytic models in a programming language -- as we've described on the home page. The RASON language was conceived, and the project was started by Dr. Nathan Brixius during his time as CTO of Frontline Systems.

An Example Optimization Model

Below is an example RASON optimization model. Its purpose is to find the optimal location for an airline hub that serves six cities. The cities are located at the (simplified x-y) coordinates given by the dx and dy parameters in the data section. Our goal is to find the x, y coordinates of the airline hub that will minimize the distance flown to any of the cities.

{
    engineSettings : { engine : "GRG Nonlinear" },
    variables :
    {
        x : { value: 1.0, finalValue: [] },
        y : { value: 1.0, finalValue: [] },
        z : { value: 1.0, finalValue: [] }
    },
    data :
    {
        dx : { dimensions: [6], value: [1, 0.5, 2, 2, 2, 0.5] },
        dy : { dimensions: [6], value: [4,   3, 4, 2, 5,   6] }
    },
    constraints :
    {
        c : { dimensions: [6], upper: 0, formula: "sqrt((x - dx)^2 + (y - dy)^2) - z" }
    },
    "objective" :
    {
        "obj" : { "type": "minimize", "formula": "z", "finalValue": [] }
    }
}

Web developers will recognize the overall syntax as that of JSON, JavaScript Object Notation -– except that identifiers and keywords are not surrounded by double quotes, outside the “objective” section which shows an example of writing “strict JSON”. The RASON Interpreter doesn’t require the quotes in a model, but the result -– the optimal solution to this nonlinear model -– is always valid JSON:

{
    "status" : { "code" : 0 },
    "variables" : {
         "x" : { "finalValue" : 1.250000 },
         "y" : { "finalValue" : 4.000000 },
         "z" : { "finalValue" : 2.136001 }
    },
    "objective" : {
         "obj" : { "finalValue" : 2.136001 }
    }
} 

RASON Models vs. Alternatives

How do RASON models compare to alternative ways of building analytic applications?

If you aren’t familiar with modeling languages, you may not realize how much the RASON language is doing for you. This is a simple nonlinear optimization model. Note that the expression "sqrt((x - dx)^2 + (y - dy)^2) - z" is an array expression operating over all six cities. The RASON Interpreter computes not just the values of this expression, but its partial derivatives with respect to x and y – used by the nonlinear optimizer to guide the search for a solution.

Web and Mobile Applications

Suppose you wanted to define and solve a model in a mobile application written in JavaScript. Powerful optimizers that would run directly on a mobile device aren’t available, nor would they be the best solution. But it’s simple to send a model to the RASON REST Server, and get the optimal solution:

    var request = { "variables" : { ...
    "z" : { "type": "minimize", "finalValue": [] } } };
    $.post("https://rason.net/api/optimize", JSON.stringify(request))
    .done(function(response){
    alert(response.objective.z.finalValue);
    });

Since RASON models are valid in JSON, we can write the entire model as an object constant in JavaScript, assigned to the variable request. Then (using JQuery syntax) we make an AJAX request to the RASON Server’s REST API endpoint optimize, which means “optimize this model and immediately return the result.” When the server returns a response, the “done” function is called, and it can easily reference the final value of the objective, since the response is also JSON.

What about a mixed-integer or global optimization model that might take 30 minutes – or overnight - to run? That’s easy: With a POST to rason.net/api/model, you can create a “model resource,” then start an optimization via GET rason.net/api/model/id/optimize, check on its progress at any time with GET rason.net/api/model/id/status, and obtain results when finished with GET rason.net/api/model/id/result.

Server-Based Applications

Next, suppose you wanted to define and solve the model in an application on a corporate server or Web server. RASON tools make that easy, too. Since the RASON Interpreter is embedded in Frontline’s Solver SDK® product, an object-oriented library callable from a wide range of languages such as C++, C#, Java and PHP, you can simply load and run a RASON model from a text file on the server:

Problem prob = new Problem();
prob.Load("model.json");
prob.Solver.Optimize();
MessageBox.Show(prob.FcnObjective.FinalValue[0].ToString());

This C# example just hints at how you can easily access RASON model elements from code, to update data, optimize or simulate, modify the model, or monitor the solver’s progress.

A Monte Carlo Simulation Model

Below is a simple Monte Carlo simulation / risk analysis model. The mean, stdev, min and max properties retrieve summary statistics for the distribution of revenue in the JSON result. With percentiles and trials properties, you can retrieve further details of the simulation.

{
    data :
    {
        "price" : { value: 200 },
        "capacity" : { value: 100 },
        "sold" : { value: 110 },
        "refund_no_shows" : { value: 0.5 },
        "refund_overbook" : { value: 1.25 }
    },
    uncertainVariables : 
    {
        "no_shows" : { formula: "PsiLogNormal(0.1*sold, 0.06*sold)" }
    },
    formulas :
    {
        "show_ups" : { formula: "sold - Round(no_shows, 0)" },
        "overbook" : { formula: "Max(0, show_ups - capacity)" }
    },
    uncertainFunctions :
    {
        "revenue" : { formula: "price*(sold - refund_no_shows * Round(no_shows, 0) - refund_overbook * overbook)",
        mean : [], stdev: [], max : [], min : [] }
    }
}

Next: Data Binding and Dimensional Flexibility