I’m trying to build a super-set so i can collect parameters / variables about items that come from different sets.
Sets
fruit / apple, orange /
veggie / carrot, tomato /
;
Parameters
FruitCost /
apple .99
orange .89
/
VeggieCost /
tomato .63
carrot .83
/;
Set food / #fruit #veggie /;
Parameter FoodCost(food);
FoodCost(fruit) = FruitCost(fruit);
FoodCost(veggie) = FruitCost(veggie);
display FoodCost;
However, when I run this i get a domain violation, which is essentially that allthought my ‘food’ set contains all the elements of the ‘fruit’ set, the ‘fruit’ set is not a subset of ‘food’ and so it isn’t a legal assignment.
68 FoodCost(fruit) = FruitCost(fruit);
**** $171
69 FoodCost(veggie) = FruitCost(veggie);
**** $171
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Error Messages
171 Domain violation for set
**** 2 ERROR(S) 0 WARNING(S)
How do I make ‘food’, ‘fruit’ and ‘veggie’ compatible so I can aggregate parameters and variables across sets?