Reporting the contents of the Progress window

  • 20 February 2020
  • 6 replies

Userlevel 2
Badge +4

I would like to report the contents of the Progress window such as the number of variables, parameters, non-zeros, objective function, solve-time, used method, etc. to a customized log file in a preferably .txt or .xlsx file formats.

My goal is to have separate log files for each run so I can analyze specific parameters,  e.g. the relation between objective function, solver method, and solving time. 

I already found a way, in which the solver (I use Gurobi) writes this information together with a specific number of solving iterations to a log file in the log folder. This method has two major drawbacks for me:

First, with every run, the new log will be added to the older log in the same .txt file. So I have to exit the AIMMS after each run to have separate log files!

Second, there is a lot of information in this log file that I have no interest in. So I need to write an algorithm in a third-party application to fish the needed values.


Are you aware of any method to achieve my goal without facing those drawbacks? 


p.s. I use the developer version with the educational license. 


Best answer by Gertjan 23 February 2020, 16:55

View original

6 replies

Userlevel 5
Badge +2

Hi @afattahi.


Maybe you could create your own log file.


For instance, you can access math model information using this sentence:

parameter_NumberOfConstraints := yourMathProgram.NumberOfConstraints;

you can also use advanced functions: Aimms GMP functions.


You can create the file and print parameter_NumberOfConstraints within model instances loop, hence you would have one log for each instance.

Userlevel 6
Badge +6

The link below brings you to a chapter that explains how you can create complete custom reports. This could contain the items you mentioned above (and more).

Of course there are also file manipulation functions (create, copy, delete etc) that allows you to set aside such a file for each run.


Instead of (or next to) pushing them to a text reports, you can also store the results in an identifier with a scenario-index. This way you can also analyze (average, min, max, trends etc) and visualize the results in the graphical UI.

Userlevel 2
Badge +4

Thanks to @Gertjan, after reading the first link, now I know how to make a custom log file. I realized that the main barrier for me is to find the name of my desired identifiers for reporting. 

@mateusarakawa Thank you so much. Using your insight, now I can write my desired math program identifiers into my excel sheet report. I found the complete list of math program suffices in the "AIMMS The Language Reference". 

However, I cannot find the list of Project Options-related identifiers such as project title, solver name, and solver specific (Cplex or Gurobi) options. I already tried using " option.method " or " 'Gurobi 8.1’.method " identifiers but they do not work. 

Moreover, I could not find the name of identifiers for some information on the Progress window such as Total Time, Memory Used, and Model Type. 

Do you know how/where can I generate/find the list of the mentioned identifiers?

Userlevel 5
Badge +2

Hi, @afattahi. Glad that things are working out.


I think you can find most of your information under GMP::Solution:: (memory, time)



  • Solver name: Inside your instances loop you can set the solver that will be used to optimize and log it. Set default solver
  • Solver specific options: You can find them within the project options window, and you can change them also inside your instances loop and log it:


StringParameter_CPLEX_MIP_METHOD_AUTOMATIC := “Automatic”;

OptionSetString(ElementParanter_YourSolver + "::MIP_method",StringParameter_CPLEX_MIP_METHOD_AUTOMATIC);

Procedure_Log(“Method: “ + StringParameter_CPLEX_MIP_METHOD_AUTOMATIC);


  • Regarding memory, there are other alternatives: AIMMS provides a native function MemoryInUse, but if I recall correctly it is the total memory reported by the operation system. There is other function MemoryStatistcs, please take a look at it, if previous fuctions don’t help you.
  • Project title: you can get it using function OptionGetString(“Project title”,YouStringParameter_ProjectTitle);
  • Regarding time you can also log your code using CurrentToString function.




Userlevel 2
Badge +4

Hi @mateusarakawa ,


Thank you for your comprehensive reply, it was very helpful. For other interested people I will summarize what I did:

  • I used GMP instead of simple SOLVE function in order to be able to call specific identifiers such as: 
    • GMP::Solution::GetMemoryUsed for Peak Memory
    • GMP::Solution::GetTimeUsed for Solving Time
    • GMP::Solution::GetIterationsUsed for Number of Iterations
    • GMP::Instance::GetNumberOfRows for Number of Constraints
    • GMP::Instance::GetNumberOfColumns for Number of Variables
    • etc.
  • I created a StopWatch in my main procedure to calculate the Total Solve Time. Take a look at Creating StopWatch in AIMMS to time execution if your're interested. 
  • I used MemoryInUse() function to report Used Memory.

For Project Options, I got a bit confused (Sorry, I am very new to AIMMS). I tried the identifiers that you mentioned(StringParameter_CPLEX_MIP_METHOD_AUTOMATIC), but I could not retrieve any value. It would be great if I find out that in general, how can I call/get any project option value that I want (both general options and solver specific options)?

Userlevel 5
Badge +5



I tried the identifiers that you mentioned(StringParameter_CPLEX_MIP_METHOD_AUTOMATIC), but I could not retrieve any value.

What Mateus described in is, 

Declare a string parameter named StringParameter_CPLEX_MIP_METHOD_AUTOMATIC and use that to assign values to options. Like in the code, 


StringParameter_CPLEX_MIP_METHOD_AUTOMATIC := “Automatic”;

OptionSetString(ElementParanter_YourSolver + "::MIP_method",StringParameter_CPLEX_MIP_METHOD_AUTOMATIC);


First, you are updating value of StringParameter_CPLEX_MIP_METHOD_AUTOMATIC as “Automatic”, then using that string parameter to set the option value using the function OptionSetString. 


The below code is equivalent but by using a string parameter, you are storing the value “Automatic” and (re)using it in multiple places - first setting the option value and then logging that information. 

OptionSetString(ElementParanter_YourSolver + "::MIP_method",”Automatic”);


but I could not retrieve any value. It would be great if I find out that in general, how can I call/get any project option value that I want (both general options and solver specific options)?


To retrieve option values, you can use the functions OptionGetString or OptionGetValue. There are other functions as well, read more here:

You can lookup the data of predeclared set AllOptions to find the exact option name. 



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

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