From 0edfb5ab9e22a040a7684770ff277e5c1559efbd Mon Sep 17 00:00:00 2001 From: Will Usher Date: Wed, 18 Jan 2023 14:10:49 +0100 Subject: [PATCH] Initial commit --- .gitignore | 3 +++ island_data.txt | 29 +++++++++++++++++++++++++++++ island_model.txt | 24 ++++++++++++++++++++++++ license.txt | 7 +++++++ readme.md | 14 ++++++++++++++ 5 files changed, 77 insertions(+) create mode 100644 .gitignore create mode 100644 island_data.txt create mode 100644 island_model.txt create mode 100644 license.txt create mode 100644 readme.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..606d842 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.lp +results.txt +*.sol \ No newline at end of file diff --git a/island_data.txt b/island_data.txt new file mode 100644 index 0000000..2cac1d9 --- /dev/null +++ b/island_data.txt @@ -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; diff --git a/island_model.txt b/island_model.txt new file mode 100644 index 0000000..c353eec --- /dev/null +++ b/island_model.txt @@ -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; diff --git a/license.txt b/license.txt new file mode 100644 index 0000000..9ab2d0b --- /dev/null +++ b/license.txt @@ -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. \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..623a72b --- /dev/null +++ b/readme.md @@ -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`.