How to build a crossroad/ 2 ways

  • 15 March 2021
  • 9 replies



I want to build a model that can transport stuff from (i to j) directly or by stopping over at facility r.

The transportcost (i to r) and (r to j) are cheaper than the direct transport (i to j).



Open(r ) is either 0 or all possible r are opened and the amount is divided up evenly

Even if transportcosts are way lower for the extrastop r than without, the model does never choose to move all products past extrastop r. (capacities are more than enough)



(goal is to minimize total cost (fixed cost and transport cost included)

Related Constraints:

  1. Amount(i,r)+Amount(d,r)<=Demand(i)*OpenRecycling( r) // index (i,d,r)
  2. sum(i,Amount(i,r))+sum(d,Amount(d,r))<=Capacity(r)* Open( r)   //index (r )
  3. sum(r,Amount(i,r))+sum(r,Amount(d,r))=(Returnrate(i)*(demand(i))) //index (i,r)
  4. sum(i,Amount(i,d))<=Capacity(d)*open(d)      //index(d)
  5. sum(i,Amount(i,d))=sum(r,Amount(d,r))         //index(d)



Thanks for your help.

I´m more than happy to post my model if that helps


Best answer by Marcel Hunting 17 March 2021, 15:42

View original

9 replies

Userlevel 5
Badge +5

@Tom Rolf You might want to take a look at this resource on how to share an AIMMS project. 

Share an AIMMS Project — AIMMS How-To


Hey Marcel,

Thank you so much, the print version makes it so much easier as well.


You were right, constraint NB8 blocked the model.

My intention with NB8 was to make sure; the amount customers send to recycling (direct or via ´container´) does not exceed the produced amount* returnrate(0-0.9).


Without NB8 the model works really good, except recycling/disposal more than produced.

And it keeps opening all facilities (j) even if not used


Really appreciate the help, before It got a bit frustrating


Userlevel 5
Badge +4

Thanks. I was now able to load the data and run the model.

I am not sure whether I understand your issue completely. The model generates the constraint


RueckgesendeteMengevonCustomeranRecycling(1,1) + MengevonContaineranRecycling(1,1) <= 10 * OpenRecycling(1)

In the solution OpenRecycling(1) equals 1, RueckgesendeteMengevonCustomeranRecycling(1,1) equals 0 and MengevonContaineranRecycling(1,1) equals 9.

If your question is why the sum of RueckgesendeteMengevonCustomeranRecycling(1,1) and MengevonContaineranRecycling(1,1) is not equal to 10 then the answer is given by constraint


RueckgesendeteMengevonCustomeranRecycling(1,1) + RueckgesendeteMengevonCustomeranRecycling(1,2) +
RueckgesendeteMengevonCustomeranRecycling(1,3) + RueckgesendeteMengevonCustomeranRecycling(1,4) +
MengevonContaineranRecycling(1,1) + MengevonContaineranRecycling(1,2) + MengevonContaineranRecycling(1,3) + MengevonContaineranRecycling(1,4) = 9

This constraint enforces that the sum of RueckgesendeteMengevonCustomeranRecycling(1,1) and MengevonContaineranRecycling(1,1) can never exceed 9.

You might want to print the constraint listing to inspect the constraints as AIMMS actually generates them. You can do so by setting the following options:

  • Solvers General option 'Constraint Listing' to 'At every solve' (or 'At first solve');
  • Solvers General option 'Constraint Listing Variable Values' to 'Print variable values';

The constraint listing will be printed in the file ‘Masterarbeit.lis’ in the log folder.


Sorry, I never had to send a model. thats how I save the actual data.

Can you open the model ?



Userlevel 5
Badge +4

Hi @Tom Rolf. I still don’t see any data. How do you load the data in this project?


Please note that your zip file does not include the complete AIMMS project folder; that would be the folder with the .aimms file plus all subfolders (like MainProject).


Hi Marcel,

Thanks for the advice. This is the whole thing in .zip  

Userlevel 5
Badge +4

Hi @Tom Rolf . The zip file only contains an .ams file which is not sufficient because it does not contain any data. Please add the complete AIMMS project folder to a zip file. If the model contains sensitive data then you can also send it to our support (with a reference to this topic).

Badge should be the working


Userlevel 6
Badge +6

Hi @Tom Rolf ,

Please do post your model so community users can build on what you already created. You can do this by zipping the project folder and assign it here.


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator