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

pulp.solvers.COIN

alias of COIN_CMD

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)

Solve a well formulated lp problem

available()

True if the solver is available

copy()

Make a copy of self

defaultPath()
readsol_CBC(filename, lp, vs)

Read a CBC solution file

solve_CBC(lp)

Solve a MIP problem using CBC

pulp.solvers.CPLEX

alias of CPLEX_CMD

class pulp.solvers.CPLEX_CMD(path=None, keepFiles=0, mip=1, msg=1, options=[])

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

pulp.solvers.GLPK

alias of GLPK_CMD

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, timeLimit=None, epgap=None, **solverParams)

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

Initializes the Gurobi solver.

@param mip: if False the solver will solve a MIP as an LP @param msg: displays information from the solver to stdout @param timeLimit: sets the maximum time for solution @param epgap: sets the integer bound gap

actualResolve(lp, callback=None)

Solve a well formulated lp problem

uses the old solver and modifies the rhs of the modified constraints

actualSolve(lp, callback=None)

Solve a well formulated lp problem

creates a gurobi model, variables and constraints and attaches them to the lp model which it then solves

available()

True if the solver is available

buildSolverModel(lp)

Takes the pulp lp model and translates it into a gurobi model

callSolver(lp, callback=None)

Solves the problem with gurobi

findSolutionValues(lp)
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, keepFiles=0, mip=1, msg=0, cuts=None, presolve=None, dual=None, strong=None, options=[], fracGap=None, maxSeconds=None, threads=None)

Bases: pulp.solvers.COIN_CMD

This solver uses a precompiled version of cbc provided with the package

actualSolve(lp, callback=None)

Solve a well formulated lp problem

available()

True if the solver is available

class pulp.solvers.PYGLPK(mip=True, msg=True, options=[], *args, **kwargs)

Bases: pulp.solvers.LpSolver

The glpk LP/MIP solver (via its python interface)

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: exceptions.Exception

Pulp Solver-related 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)

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)

reads the configuration file to initialise the module

Previous topic

pulp: Pulp classes

This Page

Creative Commons License
PuLP documentation by Pulp documentation team is licensed under a Creative Commons Attribution-Share Alike 3.0 New Zealand License.