diff --git a/solvers/gurobi_solver.cc b/solvers/gurobi_solver.cc index a2d10340fbaf..710bd519bc3d 100644 --- a/solvers/gurobi_solver.cc +++ b/solvers/gurobi_solver.cc @@ -954,9 +954,7 @@ void GurobiSolver::DoSolve2(const MathematicalProgram& prog, // Copy the remaining options into model_env. options->Respell([](const auto& common, auto* respelled) { - if (common.print_to_console) { - respelled->emplace("LogToConsole", 1); - } + respelled->emplace("LogToConsole", common.print_to_console ? 1 : 0); if (!common.print_file_name.empty()) { respelled->emplace("LogFile", common.print_file_name); }