Skip to content

Instantly share code, notes, and snippets.

@ymirpl
Created November 7, 2010 21:56
Show Gist options
  • Save ymirpl/666895 to your computer and use it in GitHub Desktop.
Save ymirpl/666895 to your computer and use it in GitHub Desktop.
set RETAILERS ordered := 1 .. 23;
set DIVISIONS;
set MATERIALS;
var oilMarket{i in 1 2 3};
var Agroup;
var Bgroup;
var spiritMarket;
param matrix;
# przydzial punktu do dywizji
var a{r in RETAILERS, d in DIVISIONS} binary;
subject to computeOilMarket1:
oilMarket[1] = sum {r in RETAILERS} (matrix[r][oil] * matrix[r][region1]);
subject to computeOilMarket2:
oilMarket[2] = sum {r in RETAILERS} (matrix[r][oil] * matrix[r][region2]);
subject to computeOilMarket3:
oilMarket[3] = sum {r in RETAILERS} (matrix[r][oil] * matrix[r][region3]);
subject to computeSpiritMarket:
spiritMarket = sum {r in RETAILERS} matrix[r][spirit];
subject to computGroupA:
Agroup = sum {r in RETAILERS} (matrix[r][categoryA]);
subject to computGroupB:
Bgroup = sum {r in RETAILERS} (matrix[r][categoryB]);
subject to ogr1:
(sum {r in RETAILERS} (matrix[r][oil] * a[r][D1]))/spiritMarket >= 0.35;
subject to ogr2:
(sum {r in RETAILERS} (matrix[r][oil] * a[r][D1]))/spiritMarket <= 0.45;
subject to ogr3:
(sum {r in RETAILERS} (matrix[r][oil] * a[r][D2]))/spiritMarket >= 0.55;
subject to ogr4:
(sum {r in RETAILERS} (matrix[r][oil] * a[r][D2]))/spiritMarket <= 0.65;
# suma procencikow
subject to ogr5:
sum {r in RETAILERS} (matrix[r][oil] * a[r][D2]) <= 0.65;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment