C# — How to suppress “Set parameter LicenseID to value …” despite LogToConsole=0 and OutputFlag=0
AnsweredHello Gurobi Support Team,
I am trying to run Gurobi from C# with a fully silent console. Even after disabling all logging, I still see a single line printed:
Set parameter LicenseID to value 2705893
Minimal reproducible snippet (C#/.NET):
using Gurobi;
class Repro
{
static void Main()
{
using var env = new GRBEnv();
// Disable all logging to console and log file
env.Set(GRB.IntParam.LogToConsole, 0);
env.Set(GRB.IntParam.OutputFlag, 0);
env.Set(GRB.StringParam.LogFile, "");
// Set license ID
env.Set(GRB.IntParam.LicenseID, 2705893);
// Create a model
using var m = new GRBModel(env);
}
}
Observed behavior:
Despite the parameters above, the console prints:
Set parameter LicenseID to value 2705893
No other output appears (which is desired).
Expected behavior:
No console output at all.
-
Hi Yuan,
To suppress all Gurobi logging, including LicenseID information, you need to set the parameter OutputFlag or LogToConsole to 0 on an empty environment before it is started.
GRBEnv env = new GRBEnv(true); env.Set(GRB.IntParam.LogToConsole, 0); env.Set(GRB.IntParam.OutputFlag, 0); env.Start();I hope this helps!
Best regards,
Simran0
Please sign in to leave a comment.
Comments
1 comment