Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix #23

Open
qjhart opened this issue Apr 1, 2016 · 2 comments
Open

Matrix #23

qjhart opened this issue Apr 1, 2016 · 2 comments

Comments

@qjhart
Copy link
Collaborator

qjhart commented Apr 1, 2016

Hobbes matrix formulation

Minimize \sum_i \sum_j \sum_k c_ijk X_ijk
Such that:
\sum_i \sum_k X_ijk = \sum_i \sum_k a_ijk * X_ijk + b_j
X_ijk <= u_ijk
X_ijk > l__ijk

cnf [cnf options] matrix [matrix options]  _nodes/links_

Where Options 
--[file] : File to save the csv files for the inputs
_nodes/links_ : 
Example:
cnf --network=network.geojson --start=2002-10 --stop=2003-09  --file=cost.csv matrix ALL

Naming Convention

Nodes in the matrix formulation, both i and j, will be named: as node@y-m, (eg. sr_sha@1980-10). Initial and final conditions will be name node@initial and node@final. In the connectivity matrix, only storage nodes will connect from one date to another, sr_sha@1980-10 -> sr_sha@1980-11. All other connections happen within a single date. sr_sha@1980-10 -> c432@1980-10.

Matrices;

Although the above formulation shows four vectors in ijk; a, c, l, u. We will actually output these together in a single matrix. For lower and upper bounds, empty values indicate that there is not bound.

i,j,k,a,c,l,u
sr_sha@1980-10,c342@1980-10,1,0.8,-50,0,200
sr_sha@1980-10,c342@1980-10,2,0.8,-30,0,600

Costs

The convex penalty functions in Hobbes are converted to a set of individual links with common ij but differing k. Each component references one segment of the penalty function. Bounds are added to each link to bound the use of that particular segment. Extrapolation of the functions follows the specification in the HEC-PRM manual.

Upper and Lower Bounds

Also, in Hobbes, each link can be given a lower and upper bound. If these bounds exist with a penalty function, then these bounds are attached to the appropriate _k_th links.

Inflows (bj)

To b_j or not to b_j. The original formulation uses water additions b_j into the network. An equivalent formulation adds two additional nodes, the Source and the Sink. b_j formulations are modeled as flows to/from these super nodes. In the above matrix, these are shown as:

i,j,k,a,c,l,u
Source,sj_sha@1980-10,1,0,0,333,333
c342@1980-10,Sink,1,0,0,55,55

This is how these inflows are represented in the output. The inflow vector, b_j can be replicated by searching for all rows with i equal to a source, and then simply including the 2nd, and 6th columns.

Evaporation

Evaporation is represented as an a_ijk term from one storage link to the next. The storage amount X_ijk is multiplied by a storage to area factor, and then by the evaporation rate per surface area.
There is only one link on this, k=1, so c_ij1 = U_i * ER_i. Where U_i is the conversion factor, and ER_i is the evaporation rate.

Debugging

Debug flows will be represented in a similar manner as they are in the Hobbes Network.

@jrmerz
Copy link
Collaborator

jrmerz commented Apr 18, 2016

@jrmerz
Copy link
Collaborator

jrmerz commented Apr 19, 2016

@qjhart FYI.

It currently creates the matrix, though I have not wired the source, sink and buffer nodes. Just creates matrix for given nodes. The id format is '[prmname]:[YYYY-MM-DD]:c[\d+]' where c0, c1, c2 is the cost function iteration. The cost is the slope for that section.

I have a couple questions about k values, unspecified upper and lower bounds (currently set to 99999 and 0 respectively), among other things. Not sure if I should ask those here or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants