Ant-Colony Optimization

Dear All,

I want to develop Routing Problem Model using Ant-Colony method, does AIMMS possible to generate the method? Are there any example that anyone could share..?


Thank you very much


11 replies

Thanks for the question Farhan

We’ve recently used an ant colony optimization method in our just released demand forecasting app. In this app we use it to refine the forecast model each period when we get new actual demand data.

I’m not the developer but my understanding is this was coded directly in AIMMS, perhaps @Zsolt Mihály can give some further insight



Userlevel 2

Dear Farhan,

it is indeed possible to create a routing problem model using ant colony optimization in AIMMS. Basically, you need to create processes to care about the followings:

  • Solution construction
    • Creating a routing by adding customers one by one
  • Solution evaluation
    • Evaluating the quality of the solution. E.g. length of tour
  • Pheromone update
    • Changing the pheromon values according to the quality of the solutions
  • Checking the stop criterion
    • When to stop the optimization

If you have any further questions, you can share them with us.




Userlevel 2

Dear Farhan,


It is another possibility to use premade libraries to solve the Routing Problem Model.

if you mean TSP by Routing Problem Model, you can use some python libraries (e.g. acopy, ACO-pants). If it is rather a VRP, you can use some R libraries (e.g. antcolony.lavaan, evoper).


In AIMMS, you can execute python and R scripts.

How to execute a python script in AIMMS:

How to execute an R script in AIMMS:



Thanks @Brian Dooley and @Zsolt Mihály for your response

Yes, I’m creating a VRP model, Multi-depot with inter-facilities. Currently I have the educational version of AIMMS, is it possible to add the R libraries? or is it only for Pro version..?

Userlevel 6

@Farhan Surury , you can use the R-Link. Please follow instructions


Looking at your question, you could also be interested in the AIMMS-MOPTA modeling competition… create a team and participate. All information can be found here:

Hi @Farhan Surury 
Was Gertjans answer sufficient in answering your question?


Hi @Zsolt Mihály and @Gertjan, Could you share such an example model which is made in AIMMS directly..?

Userlevel 6

Hi @Farhan Surury, we do not have specific example of what you are trying to build. 

Please know the R link doc shows an example on how to use it (Iris). Online there is all kinds of literature on using ACO for Vehicle Routing. AIMMS itself has tutorials on how to create models and loads of other specifics, including a set of examples including routing (see link below). If you combine those three sources, you should be able to build what you need.

If this is not sufficient, maybe it’s best to share what you have so far and ask what you are missing so people can pitch in. 



Hi @Gertjan, i’ve built multi-depot VRP and had issues with some duplicate column. Here I attached the file. perhaps you can help me to fix the issue, and also guide me to built the ACO algorithm. Thanks before

Userlevel 4

@Farhan Surury , duplicate columns are not the reason why your model is infeasible. See Marcel’s comment here:


It looks like there are some conflicting constraints which are making the model infeasible but we cannot debug further without knowing what your variables and constraints represent / the symbolic formulation of your model. constraints highlighted in blue are infeasible, I am suspecting FlowBalance and DemandConstraint are not declared properly


Do you have an paper/source for the ACO algorithm ? If yes, we could guide you on how to implement that

Hi @mohansx 


Thanks for your reply, actually I’m trying to develop Multi-depot Green VRP with inter facilities. So the main idea is products could be transfered directly from “Kilang” (depot) to “Depot” (customer), and also to “Terminal” (Inter Facilities) to buffer some products. Since it is multiobjective, least cost and emission, I create Fuel consumption variable to calculate either least cost and emission based on distance matrix, but the model that I already attached still focusing least cost problem.


Here i attached paper about ACO Algorithm


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

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