Matlab presolve

Hi

My question is a bit strange to ask here as it may suits Mathworks better, but I would love to hear from here.
I have written an AMPL code that has more than 38000 constraints and after AMPL resolve it has around 700 constraints. The model runs in a few seconds which is great.
The problem is the code runs for a single scenario and I need to do Monte Carlo simulation with at least 100 runs that are generated in Matlab, I could not automate with run files in AMPL. So I wrote the Matlab code for the same model, however, due to lots of looping to generate the constraints, more than 2 hours are NEEDED for the constraints alone and due to some modifications needed I did not fix and run using msylab intlinprog. I am asking for advice the other way around about Matlab optimization and efficiently generating the constraints. And what exactly are the presolve operations to reduce the complexity.

Appreciate any advice. Thanks in advance.

Hi @Sarah_O,

AMPL run files are only useful for basic scripting, for anything more complex you should use APIs such as the MATLAB API: AMPL MATLAB API — AMPL API 2.1.4 documentation. Have you tried it? AMPL is a modeling tool that is optimized for instantiating huge optimization models efficiently and one key component is the presolver. When using AMPL via APIs you are able to take advantage of a modeling tool designed for optimization from general purpose languages (i.e., avoiding to struggle to optimize the instantiation of optimization models in a language that was not designed for that).

What happens in the AMPL presolver is described in https://ampl.com/wp-content/uploads/pripre.pdf. Note that this is very hard to implement efficiently and it is one of the core components of AMPL. We are not aware of any other modeling tool that implements it.

Thank you @fdabrandao for the presolve algorithm document and the link to the API documentation. I will try the APIs