/*--------------------------------------------------------------------*/
/* Data creare
: 29.05.1997
*/
/* Data ultima modificare
: 22.09.1997
*/
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
/*
Modelul aproximeaza o dieta zilnica bazata pe citeva componente */
/*pentru care se cunosc
elementele nutritive avute in vedere.
*/
/*
Cantitatile cumparate si elementele nutritive trebuie sa se
*/
/*incadreze intre limitele
impuse. Se solicita si gasirea acelei */
/*retete care sa coste
cel mai putin posibil.
*/
/*--------------------------------------------------------------------*/
FILE fdieta="diet1.dat" /* Fisier secundar cu date prototip */
INTEGER
nrnutr READ fdieta IS nrnutr >1; /* Numar elemente nutritive impuse */
nrfood READ fdieta IS nrnutr >1 /* Numar materii de baza in dieta */
RANGE
nutr=[1,nrnutr]; /* Domeniul codurilor elementelor nutritive */
food=[1,nrfood] /* Domeniul codurilor de materii de baza */
REAL
cost[food] READ fdieta IS FOR [f IN food]cost[f]>=0;
/* Costuri pentru unitati din materiile de baza dieta */
fmin[food] READ fdieta IS FOR [f IN food]fmin[f]>=0;
/*Cantitatea minima ce trebuie cumparata din materiile de baza*/
fmax[food] READ fdieta IS FOR[f IN food]fmax[f]>=fmin[f];
/* Cantitatea maxima permisa sa fie cumparata din materiile de baza */
nmin[nutr] READ fdieta IS FOR [n IN nutr]nmin[n]>=0;
/* Cantitati minime de elemente nutritive impuse in dieta */
nmax[nutr] READ fdieta IS FOR [n IN nutr]nmax[n]>=nmin[n];
/* Cantitati maxime de elemente nutritive impuse in dieta */
amt[food,nutr] READ fdieta IS FOR [f IN food,n IN nutr]amt[f,n] >= 0
/* Continutul nutritiv pe fiecare materie de baza */
VARIABLES
Buy[food] IS FOR [f IN food] Buy[f] IN [fmin[f],fmax[f]]
/* Cantitatile de materii de baza ce vor fi cumparate */
OBJECTIVES
Fcost IS Fcost:= SUM [f IN food](cost[f]*buy[f])
/* Functia cost total dieta */
MINIMIZE Fcost
CONSTRAINTS
/* Restrictii de incadrare in limitele impuse elementelor nutritive */
Diet[nutr] IS For[n IN nutr] diet[n]:=
Sum[f IN food](amt[f,n]*Buy[f]) IN [nmin[n],nmax[n]]
END