I have a linear programming problem where I use Or-Tools interface in Java for modeling. When using SCIP, I sometimes encounter memory errors and the solving time is relatively long. Later, I changed the solverType to GLOP and the solving time was about 5s. However, when I changed it to CLP, an error is reported that it cannot find a feasible solution, with a log "



To determine the root cause of the issue, I constructed a small linear programming problem, and found that while GLOP provided the optimal solution quickly, CLP still failed to solve it. Can anyone know what might be causing this ?

ModelBuilder model = new ModelBuilder();
    double infinity = java.lang.Double.POSITIVE_INFINITY;
    Variable x = model.newNumVar(0.0, infinity, "x");
    Variable y = model.newNumVar(0.0, infinity, "y");

    System.out.println("Number of variables = " + model.numVariables());
    // x + 7 * y <= 17.5.
    model.addLessOrEqual(LinearExpr.newBuilder().add(x).addTerm(y, 7), 17.5).withName("c0");

    // x <= 3.5.
    model.addLessOrEqual(x, 3.5).withName("c1");

    System.out.println("Number of constraints = " + model.numConstraints());
    // Maximize x + 10 * y.
    model.maximize(LinearExpr.newBuilder().add(x).addTerm(y, 10.0));
    // Solve with the LP solver.
    ModelSolver solver = new ModelSolver("glop");
    final SolveStatus status = solver.solve(model);

GLOP enter image description here

CLP enter image description here

  • $\begingroup$ maybe the problem is the upper bound for each variable, you can try give a specific number, for example 9999 be upper bound to test out. $\endgroup$
    – ytsao
    Commented Oct 29, 2023 at 9:07
  • $\begingroup$ Strange, I recommend using glop anyway as we develop it and it is maintained. Can you add solver.enableOutput(true); to get some log ? $\endgroup$ Commented Oct 29, 2023 at 10:35
  • $\begingroup$ Thanks, I have tried according to your instructions, like double infinity = 9999; and solver.enableOutput(true);. The solver will print many useful information when the solvertype = glop; however, when the solvertype = clp, nothing printed, just the The problem does not have an optimal solution! in red front, as the picture shows. $\endgroup$
    – Ying
    Commented Oct 29, 2023 at 12:28

1 Answer 1


My bad. model_builder is a minimal module. Currently, it supports GLOP, CP-SAT, PDLP, and SCIP.

If you print the status, it will be MPSolverResponseStatus::MPSOLVER_SOLVER_TYPE_UNAVAILABLE.

  • $\begingroup$ I find that to create a solver using CLP, I should use MPSolver solver = MPSolver.createSolver("CLP");, instead of ModelSolver solver = new ModelSolver("CLP"); $\endgroup$
    – Ying
    Commented Oct 30, 2023 at 2:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.