disable prints from AMPL in Matlab using API

25 views
Skip to first unread message

J C

unread,
Aug 24, 2021, 1:20:00 PM8/24/21
to AMPL-group
Hello,

When I put setUp in matlab, appear the next print:

DYNAMIC JAVA PATH

 C:\Users\\Documents\amplapi\matlab\..\lib\ampl-2.0.6.0.jar

  C:\Users\\Documents\amplapi\matlab\..\matlab\matlab-lib.jar

 matlabbridgename =

    'matlab-lib.jar'

Using native binary at C:\Users\Documents\amplapi\matlab\..\bin\ampl-2.0.6.0.dll

Using api at C:\Users\Documents\amplapi\matlab\..\lib\ampl-2.0.6.0.jar

Using wrapper at C:\Users\Documents\amplapi\matlab


Anyone know if Is it possible to disable these prints in Matlab?


Other print is generated in matlab and AMPL when the solution is found, in my case the print is:

CPLEX 12.10.0.0: outlev = 0

 mipgap = 0.0

 parallelmode=-1

 CPLEX 12.10.0.0: optimal integer solution; objective 90.33415495

200 MIP simplex iterations

0 branch-and-bound nodes


I am using in Matlab the CPLEX options as: 

ampl.eval('option solver cplex;');
ampl.eval('option cplex_options "outlev = 0 mipgap = 0.0 absmipgap = 0.0 integrality = 1e-10 parallelmode=-1";');
ampl.solve();


Anyone know if Is it possible to disable these prints in Matlab? I am using "outlev=0", this option disables a lot of prints but not the above shown.


Finally

My problem is iterative and is solved through Matlab using API. When in some iteration the solution is infeasible or unbounded or simply the problem could not be solved, error messages always appear in Matlab, although I am using a routine to try to avoid this.

stat = ampl.getValue('solve_result');
if stat ~= 'solved'
    disp('the problem can not be solved');

end   

In this case I need that if the problem can not be solved only display the "disp" (not others error messages) and continue in the next iterations.


Can anyone help me?


Regards

AMPL Google Group

unread,
Aug 25, 2021, 4:04:06 PM8/25/21
to AMPL Modeling Language
Instead of ampl.solve(); you can use output = ampl.getOutput('solve;'); which will store the output of the "solve;" command in a variable instead of displaying it.


--
Filipe Brandão
am...@googlegroups.com
{#HS:1610841736-106029#}
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ampl/CAGK3HrimAZyX7Qy6LYuLCOWFT2UwFcPA0vfi-F0cNbpaeAU62A%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages