Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
willu47 committed Jan 18, 2023
0 parents commit 0edfb5a
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.lp
results.txt
*.sol
29 changes: 29 additions & 0 deletions island_data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Data section​
data;

# Set Definition​
set PP:=
coal
gas;

# Demand
param demand :=
250;

# Fuel Requirement info​
param fuel_req :=
coal 3
gas 2;

# Cost of production info​
param prod_cost:=
coal 300
gas 250;

# Fuel Availability info​
param fuel_avail:=
coal 600
gas 300;

# End statement ​
end;
24 changes: 24 additions & 0 deletions island_model.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Set and Problem declaration​
set PP;

# Parameter definition​
param fuel_req {i in PP};
param prod_cost {i in PP};
param fuel_avail {i in PP};
param demand >= 0;

# Variable description​
var x {i in PP} >=0;

# Objective function​
minimize z: sum{i in PP} prod_cost[i] * x[i];

# Constraint Specification​
s.t. Fuel {i in PP}: fuel_req[i] * x[i] <= fuel_avail[i];
s.t. Production : sum{i in PP} x[i] >= demand;

# Solve statement​
solve;

# End statement​
end;
7 changes: 7 additions & 0 deletions license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2023 Will Usher

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 changes: 14 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# MJ2380 Lecture 3 - Island Model using GNU MathProg

Provides the model and data for a simple island model.

Run the model glpsol:

glpglpsol -d island_data.txt -m island_model.txt -o results.txt

View the LP file by appending `--wlp island.lp` to the command above.

## License

You are free to use the model and data under the terms of the open source MIT license.
See `license.txt`.

0 comments on commit 0edfb5a

Please sign in to comment.