I am trying to implement a supply and demand model in AIMMS. This is the first time using it for me and I'm having some issues.
The case is as follows: There are Printer companies that supply books to Retailers. These Printers can send the books directly to retailers, or through crossdocks to be consolidated.
I have modelled the set of Printers with index P, the set of Crossdocks with index C and the set of retailers with index R. The case asks for a set of locations as the union of these three sets L = P ∪ C ∪ R. I am not sure how to model this union of sets and can't seem to find any info on this. Does anyone know how to do this?
Not sure if it matters, but the amount of Printers, Crossdocks and Retailers should be variable and dependent on an Excel input file.
Thanks!
Page 1 / 1
Hi @WRuijsscher
You can define a set of ‘Locations’ (with eg index l) and then add to all other sets ‘Locations’ in the ‘subset of’ property. The set ‘Locations’ can then be defined using the definition property: Printers + Crossdocks + Retailers.
Good to know: If you read in the subsets, the set Locations will be automatically updated as it has a definition !
Thanks for your answer! I defined it all like you described, but now I get the error that Aimms detected a cyclic definition: Locations definition] (1,0). There isn't any data in the model yet, so is this supposed to happen?
Thanks again.
I think this is solved if you do a full compile (F5) as they depend on each other. Else, restart the project to make sure all is re-evaluated.
Of course you can read the data from other sources instead of generating it. Also, you could generate it dynamically by replacing the 10, 3, 25 respectively with a Parameter of range {1 .. n }, e.g. NoCrossdocks. If you assign 25 to NoCrossdocks, the set will be generated as above again.
I have one more follow-up question. Most of the required constraints are limited to just two of the subsets, such as Crossdocks and Retailers, see the following constraint:
How does this need to be modelled in Aimms? Especially the red underligned part I'm not too sure about. Thank you.
@WRuijsscher
to have others find your new question, it best to post this as a new item (possibly linking to your previous post if that is helpful) as this current item is considered ‘answered’ and therefor is easily skipped.
A hint to solve this one: use the index ‘i’ in Locations and limit it by the subsets you mention in the sum. See for example where index ‘k’ is limited:
I just create a new topic on the suggested set construction. Perhaps interesting to read.