Skip to main content

Hi folks! We’re doing a bit of research into “what is it like to learn AIMMS after using Python for modeling”. Curious if anyone has some first hand experience to share about that?

A few specific questions:

  1. What is easier to do in AIMMS, what is easier in Python?
  2. What is the most noticeable difference in the coding itself when creating models in AIMMS vs. Python?
  3. Which resources did you find most useful when learning AIMMS, and would you have preferred a specific guide comparing it with coding in Python?
  4. Do you combine Python code with AIMMS models?

Your comments on any of these are greatly appreciated!

I see this is posted in academics, not an academic anymore for quite some time, but still want to share my experiences.

 

Easier in Python

For me one of the things still easier in python at the moment are basic input output to files. Reading some ‘semi-structured’ text file is way easier for me to do in python than it is doing the same in AIMMS. Most of these then deal with things like splitting the full text file into separate lines, do some stuff on each of the separate lines, split a string based on some delimiter.

If the file is a full fledged CSV file, then you can use the odbc connections / Excel options / DEX? / etc.

I think this might be for me because I missing some of the basic string manipulation functions in AIMMS. Recently I needed for example to do a reverse of a string and I could not find a native way in AIMMS to do this.

I am really happy that we have RegEx now in AIMMS (though unfortunately, it is always the question which dialect I have to use with which program.

Till recently, I would have also said, trying to read in other datasources like complex json files would be easier in Python, but as I have discovered recently, with DEX this has been made so much easier in AIMMS now also.

Easier in AIMMS

Anything that deals with multi-dimensional indexing. Expressions like: Give me the first combination of indexA, indexB such that some condition holds, or update a parameter for only those combinations of indices that satisfy a condition.

In theory, you can do some of these things in pandas also, but they become quickly very clunky and it does not feel native.  These are the moments that I feel that AIMMS really matches the way of thinking and close to the data I have.

One other thing I really like about AIMMS and the sets/indices is that (as long as they don’t share the same rootset) you cannot change indices: if you have a parameter pDemand(iMaterial, iTime)  it is impossible to mix up the indices. If you use something like python and for example tuples to refer to combinations, you might use the wrong order in the tuples but you will not get any error (you will just get no elements that match 🙂 )

 

Most notable differences

I have done some modelling using python and pygurobi links and for me it is the speed to quickly add some constraints, keep them in the model, but then temporarily disable them if I am testing something.

One other thing that is a super feature in AIMMS is the Math Programming Inspector. So far, to get a clear understanding of what actual model is generated, I often just export an LP file from python+gurobi and check for potential issues in there


Thanks @gdiepen ! Great insights. It’s true that it’s a topic not only for academics...


Agree with @gdiepen , nice summary!

 

Some additions

  • For me Pandas is one of the workhorses to use with files, similar as what you describe. I missed a basic StringTrim() function in the list of native string functions for example. We wrote our own, but currently I use dex for it.
  • In Python working with scikit-learn (or alike) is much easier for me than in Aimms. It works in AIMMS but my preference is to use Python.

 

Easier in aimms:

  • I think next to multi-dimensional index handling, there is also a great benefit that comes with sparse execution. I’m not sure if that is matched by any Python alternative (??), if the sizes increase I wonder how well those Python alternatives scale.
  • The whole management of math programs in it’s totality, with adding variables/constraints on symbolic level is truly great, feature rich and well tested
  • Publishing apps in my case with all access management around it, much easier
  • One-stop-shop solution, where as app developer you have everything in one place and it all seamlessly works

Reply


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

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