pulp.solvers
Interface to Solvers¶
This file contains the solver classes for PuLP Note that the solvers that require a compiled extension may not work in the current version

class
pulp.solvers.
COINMP_DLL
(mip=True, msg=True, options=[], *args, **kwargs)¶ Bases:
pulp.solvers.LpSolver
The COIN_MP LP MIP solver (via a DLL or linux so)
Parameters:  timeLimit – The number of seconds before forcing the solver to exit
 epgap – The fractional mip tolerance

actualSolve
(lp)¶ Solve a well formulated lp problem

classmethod
available
()¶ True if the solver is available

pulp.solvers.
COINMP_DLL_load_dll
(path)¶ function that loads the DLL useful for debugging installation problems

class
pulp.solvers.
COIN_CMD
(path=None, keepFiles=0, mip=1, msg=0, cuts=None, presolve=None, dual=None, strong=None, options=[], fracGap=None, maxSeconds=None, threads=None)¶ Bases:
pulp.solvers.LpSolver_CMD
The COIN CLP/CBC LP solver now only uses cbc

actualSolve
(lp, **kwargs)¶ Solve a well formulated lp problem

available
()¶ True if the solver is available

copy
()¶ Make a copy of self

defaultPath
()¶

readsol_LP
(filename, lp, vs)¶ Read a CBC solution file generated from an lp (good names)

readsol_MPS
(filename, lp, vs, variablesNames, constraintsNames, objectiveName)¶ Read a CBC solution file generated from an mps file (different names)

solve_CBC
(lp, use_mps=True)¶ Solve a MIP problem using CBC


class
pulp.solvers.
CPLEX_CMD
(path=None, keepFiles=0, mip=1, msg=0, options=[], timelimit=None)¶ Bases:
pulp.solvers.LpSolver_CMD
The CPLEX LP solver

actualSolve
(lp)¶ Solve a well formulated lp problem

available
()¶ True if the solver is available

defaultPath
()¶

readsol
(filename)¶ Read a CPLEX solution file


class
pulp.solvers.
CPLEX_DLL
(mip=True, msg=True, options=[], *args, **kwargs)¶ Bases:
pulp.solvers.LpSolver
The CPLEX LP/MIP solver PHANTOM Something went wrong!!!!

actualSolve
(lp)¶ Solve a well formulated lp problem

available
()¶ True if the solver is available


pulp.solvers.
CPLEX_DLL_load_dll
(path)¶ function that loads the DLL useful for debugging installation problems

class
pulp.solvers.
CPLEX_PY
(mip=True, msg=True, options=[], *args, **kwargs)¶ Bases:
pulp.solvers.LpSolver
The CPLEX LP/MIP solver from python PHANTOM Something went wrong!!!!

actualSolve
(lp)¶ Solve a well formulated lp problem

available
()¶ True if the solver is available


class
pulp.solvers.
GLPK_CMD
(path=None, keepFiles=0, mip=1, msg=1, options=[])¶ Bases:
pulp.solvers.LpSolver_CMD
The GLPK LP solver

actualSolve
(lp)¶ Solve a well formulated lp problem

available
()¶ True if the solver is available

defaultPath
()¶

readsol
(filename)¶ Read a GLPK solution file


class
pulp.solvers.
GUROBI
(mip=True, msg=True, options=[], *args, **kwargs)¶ Bases:
pulp.solvers.LpSolver
The Gurobi LP/MIP solver (via its python interface)
The Gurobi variables are available (after a solve) in var.solverVar Constriaints in constraint.solverConstraint and the Model is in prob.solverModel

actualSolve
(lp, callback=None)¶ Solve a well formulated lp problem

available
()¶ True if the solver is available


class
pulp.solvers.
GUROBI_CMD
(path=None, keepFiles=0, mip=1, msg=1, options=[])¶ Bases:
pulp.solvers.LpSolver_CMD
The GUROBI_CMD solver

actualSolve
(lp)¶ Solve a well formulated lp problem

available
()¶ True if the solver is available

defaultPath
()¶

readsol
(filename)¶ Read a Gurobi solution file


class
pulp.solvers.
GurobiFormulation
(sense)¶ Bases:
object
The Gurobi LP/MIP solver (via its python interface) without holding our own copy of the constraints
Contributed by Ben Hollis<ben.hollis@polymathian.com>
This is an experimental interface that implements some of the LpProblem interface, this should probably be done with an ABC Also needs tests

class
pulp.solvers.
LpSolver
(mip=True, msg=True, options=[], *args, **kwargs)¶ A generic LP Solver

actualResolve
(lp, **kwargs)¶ uses existing problem information and solves the problem If it is not implelemented in the solver just solve again

actualSolve
(lp)¶ Solve a well formulated lp problem

available
()¶ True if the solver is available

copy
()¶ Make a copy of self

getCplexStyleArrays
(lp, senseDict={0: 'E', 1: 'G', 1: 'L'}, LpVarCategories={'Integer': 'I', 'Continuous': 'C'}, LpObjSenses={1: 1, 1: 1}, infBound=1e+20)¶ returns the arrays suitable to pass to a cdll Cplex or other solvers that are similar
Copyright (c) Stuart Mitchell 2007

solve
(lp)¶ Solve the problem lp


class
pulp.solvers.
LpSolver_CMD
(path=None, keepFiles=0, mip=1, msg=1, options=[])¶ Bases:
pulp.solvers.LpSolver
A generic command line LP Solver

copy
()¶ Make a copy of self

defaultPath
()¶

static
executable
(command)¶ Checks that the solver command is executable, And returns the actual path to it.

static
executableExtension
(name)¶

setTmpDir
()¶ Set the tmpDir attribute to a reasonnable location for a temporary directory


class
pulp.solvers.
PULP_CBC_CMD
(path=None, *args, **kwargs)¶ Bases:
pulp.solvers.COIN_CMD
This solver uses a precompiled version of cbc provided with the package
just loads up COIN_CMD with the path set

pulp_cbc_path
= '/home/stu/dev/pulp/src/pulp/solverdir/cbc/linux/64/cbc'¶


class
pulp.solvers.
PYGLPK
(mip=True, msg=True, options=[], *args, **kwargs)¶ Bases:
pulp.solvers.LpSolver
The glpk LP/MIP solver (via its python interface)
Copyright ChristopheMarie Duquesne 2012
The glpk variables are available (after a solve) in var.solverVar The glpk constraints are available in constraint.solverConstraint The Model is in prob.solverModel

actualSolve
(lp, callback=None)¶ Solve a well formulated lp problem

available
()¶ True if the solver is available


exception
pulp.solvers.
PulpSolverError
¶ Bases:
pulp.constants.PulpError
Pulp Solverrelated exceptions

class
pulp.solvers.
XPRESS
(path=None, keepFiles=0, mip=1, msg=1, options=[])¶ Bases:
pulp.solvers.LpSolver_CMD
The XPRESS LP solver

actualSolve
(lp)¶ Solve a well formulated lp problem

available
()¶ True if the solver is available

defaultPath
()¶

readsol
(filename)¶ Read an XPRESS solution file


class
pulp.solvers.
YAPOSIB
(mip=True, msg=True, options=[], *args, **kwargs)¶ Bases:
pulp.solvers.LpSolver
COIN OSI (via its python interface)
Copyright ChristopheMarie Duquesne 2012
The yaposib variables are available (after a solve) in var.solverVar The yaposib constraints are available in constraint.solverConstraint The Model is in prob.solverModel

actualSolve
(lp, callback=None)¶ Solve a well formulated lp problem

available
()¶ True if the solver is available


pulp.solvers.
ctypesArrayFill
(myList, type=<class 'ctypes.c_double'>)¶ Creates a c array with ctypes from a python list type is the type of the c array

pulp.solvers.
initialize
(filename, operating_system='linux', arch='64')¶ reads the configuration file to initialise the module