Problem Module

API Reference

Below is the API reference for submodules of the Problem module.

Submodule Components

Triangle.h

class Triangle : public Problem
#include <Triangle.h>

The Triangle class is a subclass of the main Problem class. This class represents the six-utility North Carolina Research Triangle water management and planning problem.

Created by Bernardo on 11/23/2017.

Public Functions

Triangle(unsigned long n_weeks, int import_export_rof_table)

Constructor for a new Triangle object.

Parameters:
  • n_weeks – An integer representing the number of weeks in the simulation.

  • import_export_rof_table – An integer indicating the ROF table import/export/ignore mode.

~Triangle()

Destructor for the Triangle object.

virtual int functionEvaluation(double *vars, double *objs, double *consts) override

Runs the North Carolina Research Triangle (6-utility) problem.

Todo:

check for solutions in which a utility does not have an allocation on Jordan Lake (or any generic lake) but still pay for joint treatment infrastructure).

Parameters:
  • vars – A pointer to a double containing the number of variables in the problem.

  • objs – A pointer to the double containing the number of objectives in the problem.

  • consts – A pointer to the double containing the number of constraints in the problem.

int simulationExceptionHander(const std::exception &e, Simulation *s, double *objs, const double *vars)

Handles exceptions that occur during the simulation by printing the rank of the error-causing thread’s decision variables to a file and printing the exception message to the console.

Parameters:
  • e – An exception object

  • s – A pointer to the simulation object

  • objs – A pointer to the objectives array

  • vars – A pointer to the decision variables array

Returns:

int

void readInputData()

Reads in all input inflow, evaporation, and demand data for the Triangle problem.

Returns:

void

Private Members

const int n_utilities = 6

An integer indicating the default number utilities in the Triangle problem.

vector<vector<double>> streamflows_durham

A 2D vector of all Durham’s historical and synthetic streamflows.

vector<vector<double>> streamflows_flat

A 2D vector of all Lower Flat River’s (Raleigh) historical and synthetic streamflows.

vector<vector<double>> streamflows_swift

A 2D vector of all Swift Creek’s (Raleigh) historical and synthetic streamflows.

vector<vector<double>> streamflows_llr

A 2D vector of all Little River’s (Raleigh) historical and synthetic streamflows.

vector<vector<double>> streamflows_crabtree

A 2D vector of all Crabtree Creek’s (Raleigh) historical and synthetic streamflows.

vector<vector<double>> streamflows_phils

A 2D vector of all Phils Creek’s (OWASA) historical and synthetic streamflows.

vector<vector<double>> streamflows_cane

A 2D vector of all Cane Creek’s (OWASA) historical and synthetic streamflows.

vector<vector<double>> streamflows_morgan

A 2D vector of all Morgan Creek’s (OWASA) historical and synthetic streamflows.

vector<vector<double>> streamflows_haw

A 2D vector of all Haw River’s (Cary) historical and synthetic streamflows.

vector<vector<double>> streamflows_clayton

A 2D vector of all Clayton’s (downstream) historical and synthetic streamflows.

vector<vector<double>> streamflows_lillington

A 2D vector of all Lillington’s (downstream) historical and synthetic streamflows.

vector<vector<double>> demand_cary

A 2D vector of all Cary’s historical and synthetic demands.

vector<vector<double>> demand_durham

A 2D vector of all Durham’s historical and synthetic demands.

vector<vector<double>> demand_raleigh

A 2D vector of all Raleigh’s historical and synthetic demands.

vector<vector<double>> demand_owasa

A 2D vector of all OWASA’s historical and synthetic demands.

vector<vector<double>> demand_pittsboro

A 2D vector of all Pittsboro’s historical and synthetic demands.

vector<vector<double>> demand_chatham

A 2D vector of all Chatham’s historical and synthetic demands.

vector<double> demand_projection_cary

A 2D vector of all Cary’s annual demand projections.

vector<double> demand_projection_durham

A 2D vector of all Durham’s annual demand projections.

vector<double> demand_projection_raleigh

A 2D vector of all Raleigh’s annual demand projections.

vector<double> demand_projection_owasa

A 2D vector of all OWASA’s annual demand projections.

vector<double> demand_projection_pittsboro

A 2D vector of all Pittsboro’s annual demand projections.

vector<double> demand_projection_chatham

A 2D vector of all Chatham’s annual demand projections.

vector<vector<double>> evap_durham

A 2D vector of all Durham’s historical and synthetic evaporation data.

vector<vector<double>> evap_falls_lake

A 2D vector of all Falls Lake’s historical and synthetic evaporation data.

vector<vector<double>> evap_owasa

A 2D vector of all OWASA’s historical and synthetic evaporation data.

vector<vector<double>> evap_little_river

A 2D vector of all Little River Raleigh’s historical and synthetic evaporation data.

vector<vector<double>> evap_wheeler_benson

A 2D vector of all Lake Wheeler and Lake Benson’s historical and synthetic evaporation data.

vector<vector<double>> evap_jordan_lake

A 2D vector of all Jordan Lake’s historical and synthetic evaporation data.

vector<vector<double>> demand_to_wastewater_fraction_owasa_raleigh

A 2D vector of all Raleigh’s demand-to-wastewater fraction.

vector<vector<double>> demand_to_wastewater_fraction_durham

A 2D vector of all Durham’s demand-to-wastewater fraction.

vector<vector<double>> demand_to_wastewater_fraction_chatham

A 2D vector of all Chatham’s demand-to-wastewater fraction.

vector<vector<double>> caryDemandClassesFractions

A 2D vector of all Cary’s demand classes fractions.

vector<vector<double>> durhamDemandClassesFractions

A 2D vector of all Durham’s demand classes fractions.

vector<vector<double>> raleighDemandClassesFractions

A 2D vector of all Raleigh’s demand classes fractions.

vector<vector<double>> owasaDemandClassesFractions

A 2D vector of all OWASA’s demand classes fractions.

vector<vector<double>> pittsboroDemandClassesFractions

A 2D vector of all Pittsboro’s demand classes fractions.

vector<vector<double>> chathamDemandClassesFractions

A 2D vector of all Chatham’s demand classes fractions.

vector<vector<double>> caryUserClassesWaterPrices

A 2D vector of all Cary’s user water prices.

vector<vector<double>> durhamUserClassesWaterPrices

A 2D vector of all Durham’s user water prices.

vector<vector<double>> raleighUserClassesWaterPrices

A 2D vector of all Raleigh’s user water prices.

vector<vector<double>> owasaUserClassesWaterPrices

A 2D vector of all OWASA’s user water prices.

vector<vector<double>> pittsboroUserClassesWaterPrices

A 2D vector of all Pittsboro’s user water prices.

vector<vector<double>> chathamUserClassesWaterPrices

A 2D vector of all Chatham’s user water prices.

vector<vector<double>> owasaPriceSurcharges

A 2D vector of all OWASA’s user price surcharges.

PaperTestProblem.h

class PaperTestProblem : public Problem
#include <PaperTestProblem.h>

The PaperTestProblem class is a subclass of the main Problem class. This class represents the three-utility Sedento Valley Problem.

Public Functions

PaperTestProblem(unsigned long n_weeks, int import_export_rof_table)

Construct a new Paper Test Problem object.

Parameters:
  • n_weeks – An integer representing the number of weeks in the simulation.

  • import_export_rof_table – An integer flag indicating to import/export/ignore mode for ROF tables.

~PaperTestProblem() override

Destroy the Paper Test Problem object.

virtual int functionEvaluation(double *vars, double *objs, double *consts) override

Runs the three-utility Sedento Valley test case problem.

Parameters:
  • vars – The number of variables to run the problem with.

  • objs – The number of performance objectives to evaluate.

  • consts – UNUSED PARAMETER

Returns:

int

void readInputData()

Reads in all input inflow, evaporation, and demand data for the Sedento Valley problem.

Returns:

void

Private Members

const int n_utilities = 3

An integer indicating the default number utilities in the Triangle problem.

vector<vector<double>> streamflows_durham

A 2D vector of one of the sources of water to Granite Quarry.

vector<vector<double>> streamflows_clayton

A 2D vector of one of the downstream streamflows.

vector<vector<double>> streamflows_flat

A 2D vector of one of the sources of water to Autumn Lake.

vector<vector<double>> streamflows_llr

A 2D vector of one of the sources of water to Autumn Lake.

vector<vector<double>> streamflows_swift

A 2D vector of one of the sources of water to Sugar Creek.

vector<vector<double>> streamflows_phils

A 2D vector of one of the sources of water to College Rock Reservoir.

vector<vector<double>> streamflows_cane

A 2D vector of one of the sources of water to College Rock Reservoir.

vector<vector<double>> streamflows_morgan

A 2D vector of one of the sources of water to College Rock Reservoir.

vector<vector<double>> streamflows_crabtree

A 2D vector of one of the sources of water to College Rock Reservoir.

vector<vector<double>> streamflows_haw

A 2D vector of one of the sources of water to Lake Michael.

vector<vector<double>> streamflows_lillington

A 2D vector of one source of downstream flows.

vector<vector<double>> evap_durham

A 2D vector of all Watertown’s historical and synthetic evaporation data.

vector<vector<double>> evap_falls_lake

A 2D vector of all Autumn Lake’s historical and synthetic evaporation data.

vector<vector<double>> evap_owasa

A 2D vector of all Fallsland’s historical and synthetic evaporation data.

vector<vector<double>> evap_little_river

A 2D vector of all Dryville’s historical and synthetic evaporation data.

vector<vector<double>> evap_wheeler_benson

A 2D vector of all Fallsland’s historical and synthetic evaporation data.

vector<vector<double>> evap_jordan_lake

A 2D vector of all Lake Michael’s historical and synthetic evaporation data.

vector<vector<double>> demand_watertown

A 2D vector of all Watertown’s historical and synthetic demands.

vector<vector<double>> demand_dryville

A 2D vector of all Dryville’s historical and synthetic demands.

vector<vector<double>> demand_fallsland

A 2D vector of all Fallsland’s historical and synthetic demands.

vector<double> demand_projection_watertown

A 2D vector of all Watertown’s annual demand projections.

vector<double> demand_projection_dryville

A 2D vector of all Dryville’s annual demand projections.

vector<double> demand_projection_fallsland

A 2D vector of all Fallsland’s annual demand projections.

vector<vector<double>> demand_to_wastewater_fraction_fallsland

A 2D vector of all Fallsland’s demand-to-wastewater fraction.

vector<vector<double>> demand_to_wastewater_fraction_dryville

A 2D vector of all Dryville’s demand-to-wastewater fraction.

vector<vector<double>> watertownDemandClassesFractions

A 2D vector of all Watertown’s demand classes fractions.

vector<vector<double>> dryvilleDemandClassesFractions

A 2D vector of all Dryville’s demand classes fractions.

vector<vector<double>> fallslandDemandClassesFractions

A 2D vector of all Fallsland’s demand classes fractions.

vector<vector<double>> watertownUserClassesWaterPrices

A 2D vector of all Watertown’s user classes water prices.

vector<vector<double>> dryvilleUserClassesWaterPrices

A 2D vector of all Dryville’s user classes water prices.

vector<vector<double>> fallslandUserClassesWaterPrices

A 2D vector of all Fallsland’s user classes water prices.