Sensitivity to cost - effects of extraction costs on optimize-surface


Sensitivity analysis to cost models

Water demands can be met by numerous sources of water. AWASH performs the allocation of water by solving an optimization problem resulting in the least costly solution to meet water demands under the environmental constraints. In this notebook, we conduct a sensitivity analysis to the choice of cost model for water.

Impact on optimize-surface

Surface water use estimates are generally known at facility-, municipality- or county-level (e.g. USGS). To relate these numbers to the surface water network, an optimization problem is solved to determine the withdrawals at each canals linking nodes of the network (gauges) to the counties. As water in the network may be insufficient to meet demands, the model quantifies this failure by considering a super source.

Two models are considered here: 1. cost is uniform, 2. cost is proportional to the relative elevation of the point of source and point of use (meaning if the gauge is at a lower altitude than the county, pumping costs are proportional to the elevation difference, if it is higher, cost is null).


In [1]:
cd("../../src/");
include("nui.jl");
include("lib/readconfig.jl");
config = readconfig("../configs/standard-1year.yml")
# setting extraction cost to 0 (option 1: cost is uniform)
config["watercost-extraction"] = false;
include("optimize-surface.jl");
include("simulate.jl");
# getting volumes and costs at the county level from the simulation
sw1 = getdata(:Allocation, :swsupply);
swc1 = getdata(:WaterCost, :swcost);
supw1 = getdata(:Allocation, :supersourcesupply);


┌──────────────────────────────────────────────────┐
    ▄▄    ▄▄      ▄▄    ▄▄       ▄▄▄▄    ▄▄    ▄▄ 
   ████   ██      ██   ████    ▄█▀▀▀▀█   ██    ██ 
   ████   ▀█▄  ▄█▀   ████    ██▄       ██    ██ 
  ██     ██ ██ ██     ██    ▀████▄   ████████ 
  ██████   ███▀▀███   ██████        ▀██  ██    ██ 
 ▄██  █▄  ███  ███  ▄█  ██▄  █▄▄▄▄▄█▀  ██    ██ 
 ▀▀    ▀▀  ▀▀▀  ▀▀▀  ▀▀    ▀▀   ▀▀▀▀▀    ▀▀    ▀▀ 
└──────────────────────────────────────────────────┘

Welcome to AWASH, the America's Water Model, version 0.7.

WARNING: using RCall.isna in module Main conflicts with an existing identifier.
Loading from saved region network...
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/laureline/.julia/v0.4/Graphs/src/common.jl:3
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/laureline/.julia/v0.4/Graphs/src/dot.jl:80
WARNING: imported binding for edges overwritten in module Main
Loading from saved water network...
Optimize a model with 68238 rows, 106088 columns and 3732956 nonzeros
Coefficient statistics:
  Matrix range    [1e+00, 1e+00]
  Objective range [2e+01, 1e+06]
  Bounds range    [0e+00, 0e+00]
  RHS range       [7e-02, 1e+14]

Concurrent LP optimizer: dual simplex and barrier
Showing barrier log only...

Presolve removed 17537 rows and 10456 columns
Presolve time: 1.89s
Presolved: 50701 rows, 95632 columns, 2338055 nonzeros

Ordering time: 0.30s

Barrier statistics:
 AA' NZ     : 1.517e+06
 Factor NZ  : 2.406e+06 (roughly 80 MBytes of memory)
 Factor Ops : 2.101e+08 (less than 1 second per iteration)
 Threads    : 1

Barrier performed 0 iterations in 3.01 seconds
Barrier solve interrupted - model solved by another algorithm


Solved with dual simplex
Solved in 17714 iterations and 3.20 seconds
Optimal objective  5.916312783e+13
Warning: unscaled primal violation = 0.000834507 and residual = 0.00108301
  5.598159 seconds (3.84 M allocations: 292.067 MB, 1.40% gc time)
supersourcesupply
[3158.4676981989687,847.6633508006535,3001.11,1071.825,0.0,297.34499999999997,120.53757515873014,1833.3406921724581,3077.1750000000006,1638.8550000000002,1362.2549999999999,3316.5340274042705,0.0,1313.85,608.5200000000001,0.0,0.0,138.3,62.23500000000001,520.2892249367089,0.0,19551.76782628147,0.0,0.0,5233.678000000002,0.0,819.9719997628058,0.0,301.2006776344092,2911.2149999999997,0.0,4867.008994386542,0.0,1056.9440893041751,0.0,0.0,0.0,96.81,0.0,0.0,0.0,0.0,518.1384976970123,3319.1999999999994,5398.899870589088,0.0,3089.630102163622,0.0,15898.197871852444,0.0,0.0,0.0,671.0562505081448,1542.0449999999998,551.0136684755921,1272.3600000000001,0.0,4104.692979286693,10477.158265531401,0.0,0.0,0.0,0.0,0.0,0.0,0.0,850.545,4731.199871975702,0.0,21208.305,0.0,17820.147528332265,8961.84,0.0,0.0,0.0,3288.8381551863004,11947.273872021164,0.0,0.0,6117.27741417213,0.0,0.0,0.0,2399.505,14395.032014999975,691.5,0.0,0.0,6182.009999999999,25815.361812858355,0.0,5317.635,17688.57,0.0,1230.8700000000001,2172.1527479356046,34678.725,0.0,0.0]
Sum: 5.915807814272358e7
swwithdrawals
[22544.587301801035,0.0,0.0,0.0,212.4093,278.80098063063065,2352.7465689130436,1155.7947996556725,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,244.3807907534246,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,19727.255566483647,0.0,0.0,0.0,0.0,0.0,0.0,0.0,16705.523642762924,0.0,2868.8593078275417,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,59.936626708074535,24885.13434588765,0.0,0.0,0.0,14694.375,0.0,0.0,1237.0035225000001,1314.6314774999996,0.0,0.0,0.0,0.0,928165.875,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1761.6607750632909,0.0,0.0]
Sum: 3.156056022572764e8
returns
[22348.111364999993,0.0,0.0,0.0,0.0,0.0,1905.0340950000002,0.0,0.0,0.0,1198.48014,0.0,421.2272249999999,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,29385.479205,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,123.204555,2566.3086300000004,0.0,0.0,0.0,0.0,0.0,0.0,0.0,919.563615,0.0,0.0,0.0,0.0,1060.52589,0.0,0.0,0.0,24043.973624999995,0.0,0.0,12450.962295,0.0,0.0,399.85296,1002.7925550000002,0.0,0.0,0.0,0.0,0.0,897448.1173199998,0.0,0.0,0.0,54.35190000000001,0.0,0.0,0.0,0.0,37.154295000000005,0.0,0.0,0.0,0.0,0.0,1597.0745699999998,0.0,0.0]
Sum: 4.4323920676875574e11
captures
[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,49.49753515485584,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,4.314325821596244,0.0,25527.152972582364,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,47.525124003278265,0.0,0.0,0.0,0.0,0.0,2122.308336648707,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
Sum: 3.180010032316497e13
Loading from saved region network...
Loading from saved water network...
Loading from saved region network...
WARNING: replacing module _mimi_implementation_WaterDemand
Creating model...
WARNING: replacing module _mimi_implementation_ReturnFlows
WARNING: replacing module _mimi_implementation_WaterNetwork
WARNING: replacing module _mimi_implementation_Aquifer
WARNING: replacing module _mimi_implementation_Allocation
WARNING: replacing module _mimi_implementation_Reservoir
Running model...
WARNING: replacing module _mimi_implementation_WaterCost
Missing usgs.11230500
Missing usgs.11075720
Missing usgs.11075720
Missing usgs.11063000
Missing usgs.11063000
Missing usgs.11413320
Missing reservoir.1894
Missing canal.02248600
Missing canal.02280500
Missing reservoir.737
Missing usgs.03337000
Missing usgs.01403535
Missing usgs.01396580
Missing usgs.01356190
Missing usgs.01446775
Missing usgs.01432000
Missing usgs.03433640
Missing usgs.09277800
Missing reservoir.1286
Missing usgs.01659000
Missing usgs.12396900
Missing usgs.12181100
Missing canal.0208463140
Missing canal.02248600
Missing canal.02280500
Missing canal.02280500
Missing canal.02280500
Missing canal.08437600
Missing canal.09475501
Missing canal.09475501
Missing canal.09522703
Missing canal.10170700
Missing canal.09475501
Missing canal.09522703
Missing usgs.11230500
Missing usgs.11075720
Missing usgs.11075720
Missing usgs.11063000
Missing usgs.11413320
Missing reservoir.1894
Missing canal.02248600
Missing reservoir.737
Missing usgs.03337000
Missing usgs.01396580
Missing usgs.01396580
Missing usgs.01356190
Missing usgs.01446775
Missing usgs.01432000
Missing usgs.03433640
Missing usgs.09277800
Missing reservoir.1286
Missing usgs.01659000
Missing usgs.12396900
Missing usgs.12181100
Missing canal.0208463140
Missing canal.02248600
Missing canal.02280500
Missing canal.02280500
Missing canal.02280500
Missing canal.02280500
Missing canal.08437600
Missing usgs.11063000
Missing canal.09475501
Missing canal.10170700
  8.988626 seconds (7.36 M allocations: 942.616 MB, 1.80% gc time)

In [2]:
# setting extraction cost proportional to relative elevation (option 2)
config["watercost-extraction"] = true;
include("optimize-surface.jl");
include("simulate.jl");
# getting volumes and costs at the county level from the simulation
sw2 = getdata(:Allocation, :swsupply);
swc2 = getdata(:WaterCost, :swcost);
supw2 = getdata(:Allocation, :supersourcesupply);


Loading from saved region network...
Loading from saved water network...
WARNING: replacing module _mimi_implementation_WaterDemand
WARNING: replacing module _mimi_implementation_WaterNetwork
Loading extraction cost from saved data...
WARNING: replacing module _mimi_implementation_Allocation
WARNING: replacing module _mimi_implementation_ReturnFlows
WARNING: replacing module _mimi_implementation_Reservoir
WARNING: replacing module _mimi_implementation_Aquifer
Optimize a model with 68238 rows, 106088 columns and 3732956 nonzeros
Coefficient statistics:
  Matrix range    [1e+00, 1e+00]
  Objective range [2e+01, 1e+06]
  Bounds range    [0e+00, 0e+00]
  RHS range       [7e-02, 1e+14]

Concurrent LP optimizer: dual simplex and barrier
Showing barrier log only...

Presolve removed 17797 rows and 12345 columns
Presolve time: 1.58s
Presolved: 50441 rows, 93743 columns, 2311371 nonzeros

Ordering time: 0.34s

Barrier statistics:
 AA' NZ     : 1.514e+06
 Factor NZ  : 2.401e+06 (roughly 80 MBytes of memory)
 Factor Ops : 2.100e+08 (less than 1 second per iteration)
 Threads    : 1

                  Objective                Residual
Iter       Primal          Dual         Primal    Dual     Compl     Time
   0   5.30567467e+19 -1.09709408e+21  2.69e+12 3.34e+05  8.88e+15     3s

Barrier performed 0 iterations in 3.24 seconds
Barrier solve interrupted - model solved by another algorithm


Solved with dual simplex
Solved in 28702 iterations and 3.45 seconds
Optimal objective  5.916282936e+13
Warning: unscaled primal violation = 5.44777e-06 and residual = 0.000963192
  3.761038 seconds (475.88 k allocations: 158.360 MB, 0.94% gc time)
supersourcesupply
[25327.950752418838,1484.1165504977057,1277.2088102442972,0.0,3909.2467393096904,297.34499999999997,120.53757515873014,1687.407185323143,0.0,0.0,0.0,3376.470654112345,0.0,32.16052653520455,608.5200000000001,0.0,0.0,138.3,0.0,520.2892249367089,442.56,4371.265886000004,0.0,0.0,1047.4682037042253,0.0,585.6419059166565,0.0,2759.0850000000005,0.0,0.0,0.0,4342.62,1991.5200000000002,16243.530216111467,19390.625337701236,20822.235114813295,96.81,0.0,0.0,2891.6706911363635,0.0,0.0,0.0,5103.49352608647,0.0,271.3596171636218,0.0,0.0,0.0,0.0,0.0,1412.2686704728799,1542.0449999999998,342.783762321746,0.0,0.0,445.7467040075053,0.0,0.0,0.0,0.0,0.0,18335.45048747398,15898.197871852499,0.0,850.545,4573.076247167767,0.0,1470.0236137347922,0.0,8170.195878332267,8961.84,0.0,0.0,0.0,3288.8381551863004,11947.273872021164,0.0,0.0,6117.277414172128,0.0,164691.99161279981,0.0,0.0,22093.47280676308,81.50095499999998,0.0,0.0,6182.009999999999,31004.108040102998,0.0,0.0,0.0,0.0,0.0,0.0,34678.725,3245.1118422766144,0.0]
Sum: 5.915807814272356e7
swwithdrawals
[375.1042475811669,0.0,0.0,0.0,212.4093,278.80098063063065,2352.7465689130436,519.3415999586202,0.0,1371.6941787323942,159.15539640287784,193.05161462043088,1071.825,0.0,0.0,0.0,0.0,29738.397633366014,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,600.6214214836491,2428.894205840643,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,2868.8593078275417,145.93350684931508,0.0,569.9416620794825,1068.9133379205177,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1362.2549999999999,0.0,0.0,0.0,24885.13434588765,0.0,0.0,0.0,14694.375,0.0,0.0,1237.0035225000001,1314.6314774999996,0.0,0.0,0.0,0.0,928165.875,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,62.23500000000001,0.0,0.0,0.0,0.0,0.0,1761.6607750632909,0.0,0.0]
Sum: 3.156056022572764e8
returns
[22348.111364999993,0.0,0.0,0.0,0.0,0.0,1905.0340950000002,0.0,0.0,1198.48014,0.0,0.0,421.2272249999999,0.0,0.0,0.0,0.0,29385.479205,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,123.204555,2566.3086300000004,0.0,0.0,0.0,919.563615,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1060.52589,0.0,0.0,0.0,24043.973624999995,0.0,0.0,12450.962295,0.0,0.0,399.85296,1002.7925550000002,0.0,0.0,0.0,0.0,0.0,897448.1173199998,0.0,0.0,0.0,54.35190000000001,0.0,0.0,0.0,0.0,37.154295000000005,0.0,0.0,0.0,0.0,0.0,1597.0745699999998,0.0,0.0]
Sum: 4.432388788660636e11
captures
[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,937.1258948320044,0.0,0.0,0.0,0.0,1249.1954246125651,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,2127.2412384638706,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,7385.593057712914,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,68.25584938894508,9841.605037182002,0.0,0.0,0.0,8236.22379338813,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
Sum: 3.1800100325056223e13
WARNING: replacing module _mimi_implementation_WaterCost
Loading from saved region network...
Loading from saved water network...
Loading from saved region network...
WARNING: replacing module _mimi_implementation_Thermoelectric
WARNING: replacing module _mimi_implementation_Livestock
WARNING: replacing module _mimi_implementation_Agriculture
WARNING: replacing module _mimi_implementation_IndustrialDemand
WARNING: replacing module _mimi_implementation_UrbanDemand
WARNING: replacing module _mimi_implementation_WaterDemand
Creating model...
WARNING: replacing module _mimi_implementation_PopulationDemand
WARNING: replacing module _mimi_implementation_ReturnFlows
WARNING: replacing module _mimi_implementation_Market
WARNING: replacing module _mimi_implementation_Transportation
WARNING: replacing module _mimi_implementation_WaterNetwork
WARNING: replacing module _mimi_implementation_Aquifer
Loading extraction cost from saved data...
WARNING: replacing module _mimi_implementation_Allocation
WARNING: replacing module _mimi_implementation_Reservoir
Running model...
WARNING: replacing module _mimi_implementation_WaterCost
Missing usgs.11230500
Missing usgs.11075720
Missing usgs.11075720
Missing usgs.11063000
Missing usgs.11413320
Missing reservoir.1894
Missing canal.02248600
Missing canal.02280500
Missing reservoir.737
Missing usgs.03337000
Missing usgs.01396580
Missing usgs.01403535
Missing usgs.01356190
Missing usgs.01446775
Missing usgs.01432000
Missing usgs.03433640
Missing canal.08437600
Missing usgs.09277800
Missing canal.10170700
Missing reservoir.1286
Missing usgs.01659000
Missing usgs.12396900
Missing usgs.12181100
Missing canal.0208463140
Missing canal.02280500
Missing canal.02280500
Missing canal.02280500
Missing usgs.11063000
Missing canal.09475501
Missing canal.09475501
Missing usgs.11230500
Missing usgs.11075720
Missing usgs.11075720
Missing usgs.11063000
Missing usgs.11413320
Missing reservoir.1894
Missing canal.02280500
Missing reservoir.737
Missing usgs.03337000
Missing usgs.01403535
Missing usgs.01396580
Missing usgs.01356190
Missing usgs.01446775
Missing usgs.01432000
Missing usgs.03433640
Missing canal.08437600
Missing usgs.09277800
Missing reservoir.1286
Missing usgs.01659000
Missing usgs.12396900
Missing usgs.12181100
Missing canal.0208463140
Missing canal.02248600
Missing canal.02280500
Missing canal.02280500
Missing canal.02280500
Missing usgs.11063000
Missing canal.09475501
Missing canal.09475501
Missing canal.10170700
  9.069215 seconds (7.09 M allocations: 930.114 MB, 1.89% gc time)

In [3]:
# comparison with usgs estimates - loading the data
recorded = readtable(datapath("extraction/USGS-2010.csv"));
swusgs = recorded[:, :TO_SW] * 1383. / 12 *config["timestep"] * numsteps;

In [4]:
# verifying that demands are met
include("mapping.jl")
println("Total differences between USGS and model case 1: ", sum(abs(swusgs.data -sum(sw1+supw1,2))), " 1000m3")
println("Total differences between USGS and model case 2: ", sum(abs(swusgs.data -sum(sw2+supw2,2))), " 1000m3")
#mapdatacty(swusgs.data -sum(sw2+supw2,2), true)


Total differences between USGS and model case 1: 2.1855452558838806e-8 1000m3
Total differences between USGS and model case 2: 2.3404194138265666e-8 1000m3

Comparison of the results


In [5]:
# Reliance supersource option 1
mapdatacty(sum(supw1,2))


WARNING: RCall.jl: 
-----------------------------------------------------------
PBS Mapping 2.69.76 -- Copyright (C) 2003-2016 Fisheries and Oceans Canada

PBS Mapping comes with ABSOLUTELY NO WARRANTY;
for details see the file COPYING.
This is free software, and you are welcome to redistribute
it under certain conditions, as outlined in the above file.

A complete user guide 'PBSmapping-UG.pdf' is located at 
/home/laureline/anaconda2/lib/R/library/PBSmapping/doc/PBSmapping-UG.pdf

Packaged on 2015-04-23
Pacific Biological Station, Nanaimo

All available PBS packages can be found at
http://code.google.com/p/pbs-software/

To see demos, type '.PBSfigs()'.
-----------------------------------------------------------


WARNING: RCall.jl: Loading required package: maptools
Loading required package: sp
Checking rgeos availability: TRUE
Loading required package: foreign
Out[5]:
RCall.RObject{RCall.VecSxp}

In [6]:
# Reliance supersource option 2
mapdatacty(sum(supw2,2))


Out[6]:
RCall.RObject{RCall.VecSxp}

In [7]:
# Comparison of reliance on supersource between option 1 and 2
mapdatacty(sum(supw1-supw2,2),true)


Out[7]:
RCall.RObject{RCall.VecSxp}

Counties in red face more failure when extraction costs are taken in consideration.

From this last map, it seems that the cost model only impacts redistribution of failure among adjacent counties, it does not seem to have effect at a larger scale. However, if we look at the same data but in percentage to total demand:


In [8]:
# Percentage of failure option 1
mapdatacty(sum(supw1,2)./sum(sw1+supw1,2)*100)


Out[8]:
RCall.RObject{RCall.VecSxp}

In [9]:
# Percentage of failure option 2
mapdatacty(sum(supw2,2)./sum(sw2+supw2,2)*100)


Out[9]:
RCall.RObject{RCall.VecSxp}

In [10]:
# Percentage of failure option 2
mapdatacty((sum(supw1,2)-sum(supw2,2))./sum(sw2+supw2,2)*100, true)


Out[10]:
RCall.RObject{RCall.VecSxp}

We see that when we do not consider extraction cost, more counties are facing 100% failure than when we do consider extraction cost. The comparison of the histograms of the percentage of failure plotted hereafter show that it is reduced by a third and that those counties do not face any failure in case 2.


In [11]:
R"par(mfrow=c(2,1))"
R"par(mar=c(4,4,2,0))"
f1prct = sum(supw1,2)./sum(sw1+supw1,2)*100
f2prct = sum(supw2,2)./sum(sw2+supw2,2)*100
R"hist($f1prct, xlab='failure in %', main='without extraction cost',breaks=20,ylim=c(0,1500))";
R"hist($f2prct, xlab='failure in %', main='with extraction cost',breaks=20,ylim=c(0,1500))";


Hereafter, we investigate how this depends on the quantity of demanded water.


In [12]:
R"par(mfrow=c(2,1))"
R"par(mar=c(4,4,1,0))"
x = swusgs;
R"plot($x,$f1prct-$f2prct, xlab = 'demand', ylab = 'difference in % of failure')";
x = log10(swusgs);
R"plot($x,$f1prct-$f2prct, xlab = 'log10(demand)', ylab = 'difference in % of failure')";


The very large users (> 1e9 m3/year) seem to face very limited failure. I do not believe it is possible to conclude anything else.

Cost of water

The last aspect is the cost of water. We plot hereafter the cost per 1000m3 of water to understand where it was not possible to withdraw water without pumping water uphill


In [13]:
# Surface water extraction cost per 1000m3
mapdatacty(sum(swc2,2)./sum(sw2,2))


Out[13]:
RCall.RObject{RCall.VecSxp}

One should note that these results were obtained using the current information in the model. At several locations, elevation information is missing. The extent of the impact it has on the optimization is unknown.