[AMPL 25070] Removing the gurobi status from Tables

Hello everyone,

I created a table in gurobi with a for loop, but that table doesnt look that beautyful with the gurobi status in it.

Thats my run data:

reset;
model 'C:\Users\anwar\Desktop\AMPL\models\datei.mod\datei.mod\A3.mod'
data 'C:\Users\anwar\Desktop\AMPL\models\datei.mod\datei.mod\A3.dat'

option solver gurobi;

# Parameter für Schrittweite und Endkapazität
# Parameter für die Kapazitätserhöhung

param step := 10; # Schrittweise Erhöhung der Kapazität um 10
param C2 := 200;

# Ausgabeheader für die Tabelle

printf "%-12s | %-15s | %-20s\n", "Kapazität", "Lösung existiert", "Zielfunktionswert";

# Schleife zur Kapazitätserhöhung von C bis 2*C

repeat {

   solve;   # CLSP mit aktueller Kapazität lösen

   # Überprüfen, ob eine zulässige Lösung existiert
   if solve_result = 'optimal' then {

      # Wenn Lösung existiert, formatierten Zielfunktionswert drucken
      printf "%-12d | %-15s | %-20.2f\n", C[1], "Ja", costs;

      } else {

      # Wenn keine Lösung gefunden wurde, drucke Kapazität und "Keine Lösung"
      printf "%-12d | %-15s | %-20s\n", C[1], "Nein", "N/A";
   }

   # Kapazität schrittweise um 'step' erhöhen
   let {b in 1..T} C[b] := C[b] + step;

} while C[1] <= 200; # Schleife bis maximaler Kapazität erreicht

display 'C:\Users\anwar\Desktop\AMPL\models\datei.mod\datei.mod\A3.solve'

Is it possible to remove the gurobi status that comes with the solution in the console? For example:

Gurobi 11.0.3: Gurobi 11.0.3: optimal solution; objective 1630
36 simplex iterations
1 branching node

I don’t want these in my table, only the row and column.

Thanks in advance.
Anwar

The solver’s result message, showing the optimal value and the numbers of iterations and nodes, can be suppressed by executing this AMPL statement before solving:

option solver_msg 0;

However, in some cases, other output may “leak” out of the solver. To remove that output, also redirect the “solve” output to the system null file, like this:

solve >NUL;         # if using Windows
solve >/dev/null;   # if using Linux or macOS

Your question has been moved to our new user forum at discuss.ampl.com, and a response has been posted there. To see the response, use this link:

https://discuss.ampl.com/t/ampl-25070-removing-the-gurobi-status-from-tables/1992/2

To reply, click the red “Reply” button that follows the response. (Do not send an email reply to this message.)