Tutorials

Learning-oriented: step-by-step lessons for beginners.

WRESL+ source code helps the modeler do two important things:

  1. Define the execution structure of your study.

  2. Define the network, constraints, and goals for your study.

To define the execution structure of your study we mostly use sequence, model, group, and include. These objects and directives tell the study what MILP problems to construct, and the order that they should be evaluated.

Below is an example that defines a 2-step study, which first solves a simple stream network problem, and then solves a more complex problem.

 1model SimpleOperations {
 2    include group StreamNetwork  // the network structure is defined in this group
 3    include 'weights.wresl'  // this file has the MILP wieght definitions
 4}
 5
 6model ComplexOperations {
 7    include group StreamNetwork
 8    include group OperationsDefinition  // in this "model" we also include operations
 9    include 'weights.wresl'
10}
11
12sequence First {
13    model SimpleOperations
14    condition always
15    order 1  // the simple model goes first
16}
17
18sequence Second {
19    model ComplexOperations
20    condition always
21    order 2  // the more complex model goes second
22}

To define the network, constraints, and goals of the study, we mostly use define, and goal objects. These objects create variables, and add constraints to the study.

Below is an example that enforces a very simple mass balance equation.

 1define INFLOW {
 2    timeseries
 3    units 'CFS'
 4    kind 'FLOW'
 5}
 6
 7define OUTFLOW {
 8    lower 0
 9    upper 100
10    units 'CFS'
11    kind 'FLOW'
12}
13
14goal MASS_BALANCE {
15    INFLOW - OUTFLOW = 0
16}

The tutorials listed below go into a little more detail: