Introduction
Insight is eWater’s multiple-objective optimisation decision support framework. This framework allows for more efficient evaluation of planning options than the traditional manual trial and error approach that is often used. In other words, the main aim of Insight is to optimise decision rules for all scenarios. The optimisation tool enables a more thorough examination of potential planning scenarios and the resulting trade-offs between desired outcomes.
Insight allows you to define which parameters (called decision variables) must be considered in the optimisation framework. Decisions variables can be thought of as management levers that can be pulled to affect the outcome. For example, you may be unsure of what the operating rules for a new desalination plant should be used to meet the objective of minimising cost, or what the optimal operating rules are for transferring water between storages to meet supply security objectives and minimising environmental impacts. By creating decision variables for these operating rules, the optimiser will try hundreds or thousands of different operating rules based on these decision variables and determine how the rules perform against a set of specified objectives.
Results of an optimisation run can be used as follows:
- Tradeoffs between competing objectives can be identified and a desirable balance between objectives can be discussed; or
- Management options which achieve the desired outcomes can be identified.
Decision variables
The goal of optimsation is to acheive a set of defined objectives based on decision variables that act as management levers. For example, the amount of water to release for environmental flows, the level of demand, or the amount of water to order from alternative supplies.
When deciding on decision variables, it is important to consider:
- What the key drivers are likely to be (relevance);
- Which parameter in the model represents the decision variable;
- The number of decision variables, and the consequence of multiple decision variables;
- Are they discrete or continuous (“real” numbers)?; and
- What are realistic ranges? Are there any constraints on the likely acceptable range for the decision variables?
Theoretically, the larger the number of decision variables, the closer you are to acheiving the objectives. Practically, however, the greater the number, and broader the range of each variable, the longer the run time for completion of the optimisation run problem.
Objectives
Mathematically known as objective functions, these can contain multiple parts, such as measure of cost, a measure of environmental impact and a measure of social costs. Examples of objective functions might include: minimising the operating cost of the system, minimising environmental impacts, or minimising time spent in water restrictions.
When choosing objectives, it is important to consider:
- The number of objectives;
- The independence of the objectives;
- Sensitivity of those objective functions to decision variables;
- The value of the objectives to stakeholders; and
- The ability to use outputs from the model to calculate the required objective.
Working with Insight
All tasks undertaken to carry out an optimisation run (from creating a settings file to the actual run) can be completed using either the Insight interface or a command line. These are described in further detail in subsequent sections.
Ensure that the following pre-requisites are met prior to installing Insight:
- Latest version of Source. This must be correctly installed prior to running Insight;
- Microsoft .NET framework v4 (or higher); and
- Microsoft C++ 2010 x86 redistributable package.
Additionally, at a minimum, Insight requires the following to run an optimisation:
- A Source scenario containing decision variables and objectives;
- Access to the Source command line tool;
- An Insight settings file (containing the Source project location, objectives and decision variables);
- The number of generations; and
- The population size of each generation.
The decision variables and objectives must be defined in the Source project as global expressions. Insight can then run the Source model thousands of times, setting different values for the decision variable expressions and evaluating the corresponding objectives for every individual run.
This means that in order for a Source parameter to be included in an optimisation problem, that parameter needs to be defined using the Function manager in Source.
Using the Insight interface
When you open Insight for the first time, you may be prompted to point Insight to the location of the Source command line tool (RiverSystem.CommandLine.exe), as shown in Figure 1.
Click Browse to locate and load the appropriate folder. Click OK to close the window.
Figure 1. Source command line location
Figure 2 shows the user interface for Insight, which allows you to load Source projects, configure a settings file and perform an optimisation run.
The File menu items allow you to work with settings and results as follows:
- File » Load Settings - Load settings that were previously configured and saved;
- File » Save Settings - Saves the current run settings;
- File » Load results - Loads the results of a previously saved optimisation run;
- File » Save results - Save the results of the current optimisation run; and
- File » Exit - Quits Insight.
Figure 2. Insight user interface
Prior to using Insight, ensure that you have created and saved a Source project containing one scenario only.
Setting up an optimisation run/Creating a settings file
- Open Insight and click Browse (as shown in Figure 1) to choose the directory containing the project(s);
- Click Load to populate the left panel with all the objective functions that were created in the loaded projects;
- For each of the panels on the right, use the appropriate button to add or remove objectives or variables from the main objectives list to the individual panel. For example, click Add objective » to add an objective to the Objectives panel. Moreover, to move a discrete decision variable back to the main list of objective functions, click « Remove discrete decision variable.
- In the Objectives panel, the Multi-project Aggregation Method drop-down menu allows you to choose how you want to aggregate the individual time-step results. The Aggregate over full timeseries checkbox allows you to choose how to setup the objectives. If enabled, the objective needs to be set up so that all values of the global expression are used (via the selected statistical function) to give the objective value. If not, the last value of the global expression gives the objective value. You can also remove an objective from the Objectives panel by choosing it from the list and clicking . This will move the objective back to the main objectives list.
- Choose the number of generations and the population size of each generation. These parameters define how many simulation runs are performed by the optimiser. The required values will depend on the complexity of the optimisation project. If the number of runs is too small, the optimiser will not be given sufficient time to search for the multi-objective optimal set of results.
- Specify whether to run the optimisation on your local machine (enable the Run Source optimisation locally radio button), or across server endpoints (using the Run Source optimisation on endpoints radio button). Server endpoints allow you to run the optimisation across several machines simultaneously. Load the endpoints settings file by clicking Load Endpoints and point Insight to the appropriate file. If running Source optimisation on a local machine, set the number of cores to use with the Local server limit scroll button. The number of cores to use depends on the machine you will are using.
- Save your settings using File » Save Settings. This creates a settings file, which can be used later.
The optimisation is now ready to be run.
Running an optimisation
Once you have nominated the location of Source, the Source project to optimise, and the objectives and decision variables, click Run to begin the optimisation.
On completion, the results can be saved for future use using File » Save results.
Using the command line
Insight can be configured, set up (to create a settings file) and run using the command line as well.
Creating the settings file
The settings file can be created in a text editor, such as Notepad, saved as a .txt file (such as Example_InsightSettings.txt) and must include the information shown in Table 1.
Table 1. Information required to create a settings file
Information required | Example |
---|---|
Location of the Source project file | project C:\Insight\test\Example_project.rsproj |
List of the objectives, using the global expressions in the Source project | Output $reliabilityNeg |
List of decision variables, using the global expressions in the Source project, along with their constraint | real $pipecapacity 0 200 |
Configuring the optimisation run
Once a settings file has been created, specify the following (as shown in Table 2) in the command line to configure the optimisation run.
Table 2. Information required to configure an optimisation run
Information required | Example |
---|---|
Specify to run the Insight executable file | Insight.Optimiser.Console.exe |
Location of Insight settings file | --configurationOption "C:\Insight\test\Example_InsightSettings.txt” |
The number of cores / endpoints to use | --source 2 |
The number of generations | --generations 6 |
The population size | --population 100 |
Output file name | --output “C:\Insight\test\Example_CommandLineResults_6x100.csv" |
Setting up server endpoints
Server endpoints allow you to run the optimisation across several machines simultaneously. It is recommended to discuss the use of endpoints with your IT department should you wish to choose this option.
If you wish to run the optimisation across multiple machines at once, you can do so using server endpoints, noting that:
- Each individual machine must have Source installed; and
- The project file will need to be located on a server where all machines can access it.
Endpoints can be set up manually or using the Powershell script. These are discussed separately next.
Manual set up of individual machines as endpoints
For each individual computer you wish to use in the optimisation, you will need to set it up as an endpoint(s). This is setup using the command line on each machine.
- Locate the IP address (type ipconfig in the command prompt) or machine name (in the Properties section of My Computer) for each computer you are going to use in the optimisation;
- In the command prompt, change the directory to the location of Source (ie. where Source in installed); and
- Setup the endpoint using the endpoint setup command. For example, in the following case, 8593 is the unique identifier for the endpoint:
RiverSystem.CommandLine.exe -m server -a net.tcp://localhost:8593/insight
Once setup is complete, a message will appear indicating this.
To use additional cores on an individual machine, you will need to set up multiple endpoints.
If you wish to open up another endpoint for the same machine, open up another command prompt, change to the Source directory, and enter a similar command, this time with a different endpoint identifier. For example:
RiverSystem.CommandLine.exe -m server -a net.tcp://localhost:8594/insight
Setting up endpoints using PowerShell script
You can also set up endpoints using the included PowerShell script.
Do the following on every machine that you wish to set up as an endpoint/s:
- Ensure that the RunSourceServersForInsight.ps1 file is in the same folder as RiverSystems.CommandLine.exe;
- Open PowerShell (Click on the Start menu (Windows 7), search for PowerShell, and press Enter);
- This method of setting up endpoints requires a change to the execution policy for each machine you wish to use as an endpoint. At the PowerShell command prompt, enter Set-ExecutionPolicy RemoteSigned. You will be asked to confirm the change (you can read more about this by selecting the relevant help topic). Choose Yes. Note that this needs to be done only once;
- Change the directory to the location of the RunSourceServersForInsight.ps1 file;
- Run the PowerShell script with ./RunSourceServersForInsight.ps1;
- The PowerShell script has automatically set up endpoints for you. Make a note of each endpoint, as these will be required when running the optimisation. Repeat this step across every machine that you wish to use as an endpoint. By default, the PowerShell script sets up two endpoints. To change the number of endpoints on the same computer, add the number of endpoints after the run command. For example: ./RunSourceServersForInsight.ps1 4 indicates 4 endpoints;
Running the optimisation
Once you have entered the parameters for each of the items listed in Table 2, press enter to begin the optimisation run.
As Insight computes the optimisation for each popluation, a completion notification is displayed in the command line. Figure 3 shows an example of this.
Viewing optimisation results
Results from a previous optimisation run (including those that have been run from a command line) can be loaded using File » Load results.