2
$\begingroup$

I noticed some people specify the solver as "cplex_direct" whereas others as "cplex" when passing the option to SolverFactory in Pyomo. Is there any difference between the two options? If so, what it is the difference between the two?

$\endgroup$

1 Answer 1

4
$\begingroup$

Pyomo has a number of interfaces to the CPLEX solver:

  • cplex is a wrapper around a number of (primarily file-based) interfaces to the cplex solver executable. By default, that interface writes "LP" files, but can be configured to use MPS or NL files (through the solver_io argument to the SolverFactory() call)
  • cplex_direct is an interface that communicates the model to CPLEX through the CPLEX Python bindings. In theory this can be more efficient as it avoids writing/reading text files and spawning an external subprocess. This interface can also be obtained with SolverFactory("cplex", solver_io="python").
  • cplex_persistent is an extension of the cplex_direct interface that supports a "persistent" interface to the CPLEX environment and supports more efficient "resolves" (i.e., solving a slightly modified model)
  • appsi_cplex is a complete rewrite of the direct/persistent interface to CPLEX as part of APPSI (the "auto-persistent Pyomo solver interface" project). This interface is significantly more performant, and can "automatically" detect the changed parts of the model with relatively low overhead. That said, APPSI is still very much "under development" (as of 2022), so interfaces and APIs are still subject to change.
$\endgroup$

Your Answer

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

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