reconstructing units
This commit is contained in:
parent
3f6e7ba702
commit
d5602dcc13
18
Rezept.mod
18
Rezept.mod
|
@ -1,11 +1,11 @@
|
||||||
set ZUTATEN;
|
set ZUTATEN;
|
||||||
set STOFFE;
|
set STOFFE;
|
||||||
set INDEX; #Indexmenge
|
set INDEX; #Indexmenge
|
||||||
param preis {z in ZUTATEN} >= 0;
|
param preis {z in ZUTATEN} >= 0; #in €/kg oder €/10Stück
|
||||||
param werte {z in ZUTATEN, s in STOFFE} >= 0;
|
param werte {z in ZUTATEN, s in STOFFE} >= 0; #je 100g oder Stück
|
||||||
param minwert {s in STOFFE} >= 0 default 0;
|
param minwert {s in STOFFE} >= 0 default 0; #ebenso
|
||||||
param maxwert {s in STOFFE} >= 0 default Infinity;
|
param maxwert {s in STOFFE} >= 0 default Infinity; #ebenso
|
||||||
var menge {z in ZUTATEN} >= 0;
|
var menge {z in ZUTATEN} >= 0; # in g oder Stück
|
||||||
param ref {z in ZUTATEN} >= 0 default 0;
|
param ref {z in ZUTATEN} >= 0 default 0;
|
||||||
|
|
||||||
param bezugsmenge {z in ZUTATEN} default 100; #nicht immer ist menge in 100g, teilweise in Stück
|
param bezugsmenge {z in ZUTATEN} default 100; #nicht immer ist menge in 100g, teilweise in Stück
|
||||||
|
@ -13,15 +13,15 @@ param weight_penalty >= 0 <= 1 default 0.05; #Transportkosten je 100g
|
||||||
param pill_penalty {z in ZUTATEN, i in INDEX} default 0; #für einzelne Zutaten können Strafkosten bei Überschreiten einer Höchstmenge verhängt werden
|
param pill_penalty {z in ZUTATEN, i in INDEX} default 0; #für einzelne Zutaten können Strafkosten bei Überschreiten einer Höchstmenge verhängt werden
|
||||||
#Die Höchstmenge wird in pill_penalty[z,1], die Strafkosten für jede darüberliegende Einheit in pill_penalty[z,2] gespeichert.
|
#Die Höchstmenge wird in pill_penalty[z,1], die Strafkosten für jede darüberliegende Einheit in pill_penalty[z,2] gespeichert.
|
||||||
|
|
||||||
var kaufpreis = sum {z in ZUTATEN} preis[z]/10*menge[z]; #Alnatura-Preise sind in 1kg statt 100g…
|
var kaufpreis = sum {z in ZUTATEN} preis[z]/(10*bezugsmenge[z])*menge[z]; #Alnatura-Preise sind in €/1kg statt 100g…
|
||||||
var omega_ratio = sum{z in ZUTATEN} menge[z]*werte[z,"Omega-6"]/sum{y in ZUTATEN} menge[y]*werte[z,"Omega-3"];
|
var omega_ratio = sum{z in ZUTATEN} menge[z]*werte[z,"Omega-6"]/sum{y in ZUTATEN} menge[y]*werte[z,"Omega-3"];
|
||||||
var rezeptwert {s in STOFFE} = sum {z in ZUTATEN} menge[z]*werte[z,s];
|
var rezeptwert {s in STOFFE} = sum {z in ZUTATEN} menge[z]*werte[z,s]/bezugsmenge[z];
|
||||||
var total_weight = sum {z in ZUTATEN} menge[z]*bezugsmenge[z];
|
var total_weight = sum {z in ZUTATEN} menge[z];
|
||||||
var total_pill_penalty = sum {z in ZUTATEN} max(menge[z]-pill_penalty[z,1],0)*pill_penalty[z,2];
|
var total_pill_penalty = sum {z in ZUTATEN} max(menge[z]-pill_penalty[z,1],0)*pill_penalty[z,2];
|
||||||
#Wenn die zutatenweise Obergrenze in pill_penalty[z,1] überschritten ist, werden Strafkosten für die Überschussmenge berechnet.
|
#Wenn die zutatenweise Obergrenze in pill_penalty[z,1] überschritten ist, werden Strafkosten für die Überschussmenge berechnet.
|
||||||
|
|
||||||
minimize gesamtpreis: kaufpreis*(1-weight_penalty) + total_weight/100*weight_penalty + total_pill_penalty;
|
minimize gesamtpreis: kaufpreis*(1-weight_penalty) + total_weight/100*weight_penalty + total_pill_penalty;
|
||||||
subject to ugrenze {s in STOFFE}: rezeptwert[s] >= minwert[s]; #undefined renders 0 => no problem here
|
subject to ugrenze {s in STOFFE}: rezeptwert[s] >= minwert[s]; #undefined renders 0 => no problem here
|
||||||
subject to ogrenze {s in STOFFE}: rezeptwert[s] <= maxwert[s]; #undefined should render Infinity here.
|
subject to ogrenze {s in STOFFE}: rezeptwert[s] <= maxwert[s]; #undefined should render Infinity here.
|
||||||
subject to omega_ratio_constraint: omega_ratio <= 6;
|
#subject to omega_ratio_constraint: omega_ratio <= 6;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
param weight_penalty 0.5455; #Transportkosten je 100g
|
param weight_penalty 0; #Transportkosten je 100g
|
||||||
#should be below 1. If equal 1, prices will not be taken into account.
|
#should be below 1. If equal 1, prices will not be taken into account.
|
||||||
|
|
||||||
#Um einzelne Zutaten nach Stück statt 100g zu berechnen:
|
#Um einzelne Zutaten nach Stück statt 100g zu berechnen:
|
||||||
|
|
|
@ -7,11 +7,13 @@ Omega-3 1.67
|
||||||
Omega-6 17
|
Omega-6 17
|
||||||
Fiber 28
|
Fiber 28
|
||||||
Cholesterol 0
|
Cholesterol 0
|
||||||
#VitaminA 3000
|
#VitaminA 3000 #orig min
|
||||||
|
VitaminA 2132 #orig Recipe
|
||||||
VitaminB6 1.3
|
VitaminB6 1.3
|
||||||
VitaminB12 2.4 #nnot hold
|
VitaminB12 2.4 #nnot hold
|
||||||
VitaminC 90 #cannot hold
|
VitaminC 90 #cannot hold
|
||||||
#VitaminD 600 #cannot hold
|
#VitaminD 600 #cannot hold
|
||||||
|
VitaminD 300 #orig Recipe
|
||||||
VitaminE 20.00
|
VitaminE 20.00
|
||||||
VitaminK 120
|
VitaminK 120
|
||||||
Thiamin 1.2
|
Thiamin 1.2
|
||||||
|
@ -20,7 +22,9 @@ Niacin 16
|
||||||
Folate 400
|
Folate 400
|
||||||
PantothenicAcid 5
|
PantothenicAcid 5
|
||||||
#Choline 550 #not in swiss data
|
#Choline 550 #not in swiss data
|
||||||
Calcium 1
|
Choline 255 #orig Recipe
|
||||||
|
#Calcium 1
|
||||||
|
Calcium 0.61 #orig Recipe
|
||||||
Chloride 2.3
|
Chloride 2.3
|
||||||
Chromium 35 #not in swiss data
|
Chromium 35 #not in swiss data
|
||||||
Copper 0.90 #not in swiss data
|
Copper 0.90 #not in swiss data
|
||||||
|
@ -31,6 +35,7 @@ Manganese 2.3 #not in swiss data
|
||||||
Molybdenum 45 #not in swiss data
|
Molybdenum 45 #not in swiss data
|
||||||
Phosphorus 0.7
|
Phosphorus 0.7
|
||||||
#Potassium 3.5
|
#Potassium 3.5
|
||||||
|
Potassium 3.4 #orig Recipe
|
||||||
Selenium 55 #cannot hold
|
Selenium 55 #cannot hold
|
||||||
Sodium 1.5
|
Sodium 1.5
|
||||||
Sulfur 2 #not in swiss data
|
Sulfur 2 #not in swiss data
|
||||||
|
|
|
@ -3,4 +3,4 @@ model Rezept.mod;
|
||||||
data Rezept.dat;
|
data Rezept.dat;
|
||||||
option solver "ampl.linux64/minos";
|
option solver "ampl.linux64/minos";
|
||||||
solve;
|
solve;
|
||||||
display {i in ZUTATEN} menge[i]*bezugsmenge[i], ref, total_weight, kaufpreis ;
|
display {i in ZUTATEN} menge[i], ref, total_weight, kaufpreis ;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
#alle Preise in €/(bezugsmenge*10)
|
||||||
feingemahleneHaferflockenOR 00.78
|
feingemahleneHaferflockenOR 00.78
|
||||||
SojaflockenOR 04.3
|
SojaflockenOR 04.3
|
||||||
JodsalzOR 00.22
|
JodsalzOR 00.22
|
||||||
MultivitamineOR 24.1258741258741
|
MultivitamineOR 0.241258741258741
|
||||||
SonnenblumenölOR 03.38
|
SonnenblumenölOR 03.38
|
||||||
PuderzuckerOR 00.65
|
PuderzuckerOR 00.65
|
||||||
ErbsenproteinOR 09.676
|
ErbsenproteinOR 09.676
|
||||||
|
|
|
@ -5,7 +5,7 @@ MultivitamineOR
|
||||||
SonnenblumenölOR
|
SonnenblumenölOR
|
||||||
PuderzuckerOR
|
PuderzuckerOR
|
||||||
ErbsenproteinOR
|
ErbsenproteinOR
|
||||||
##WeizenmehlOR
|
WeizenmehlOR
|
||||||
##OlivenölOR
|
##OlivenölOR
|
||||||
##MaltodextrinOR
|
##MaltodextrinOR
|
||||||
##Sojaflocken
|
##Sojaflocken
|
||||||
|
|
Loading…
Reference in a new issue