Reputation: 7484
I am using the PuLP linear programming module for Python to solve a linear problem.
I set up the problem, the constraints, and I use the default solver provided with PuLP which is CBC (the solver executable on my mac is called cbc-osx-64 for obvious reasons). When running this executable:
Welcome to the CBC MILP Solver
Version: 2.7.6
Build Date: Mar 3 2013
Revision Number: 1770
OK, I run the solver via PuLP and get a solution. When verifying that the constraints are satisfied I get a difference between the solution and what I requested (for some of the constraints, not all), which is less than 1e-6 but greater than 1e-7 (1.6e-7, e.g.).
Of course it makes sense to have a constraint tolerance, that is fine. But I need to be able to control this and I think this should be a very central and important parameter in any LP task?
So let us look at the "help" from the CBC solver (run the executable and type "?"), these are the arguments I can change:
Commands are:
Double parameters:
dualB(ound) dualT(olerance) primalT(olerance) primalW(eight) zeroT(olerance)
Branch and Cut double parameters:
allow(ableGap) cuto(ff) inc(rement) integerT(olerance) preT(olerance)
pumpC(utoff) ratio(Gap) sec(onds)
Integer parameters:
force(Solution) idiot(Crash) maxF(actor) maxIt(erations) output(Format)
slog(Level) sprint(Crash)
Branch and Cut integer parameters:
cutD(epth) cutL(ength) depth(MiniBab) hot(StartMaxIts) log(Level) maxN(odes)
maxS(olutions) passC(uts) passF(easibilityPump) passT(reeCuts) pumpT(une)
strat(egy) strong(Branching) trust(PseudoCosts)
Keyword parameters:
allC(ommands) chol(esky) crash cross(over) direction error(sAllowed)
fact(orization) keepN(ames) mess(ages) perturb(ation) presolve
printi(ngOptions) scal(ing) timeM(ode)
Branch and Cut keyword parameters:
clique(Cuts) combine(Solutions) combine2(Solutions) cost(Strategy) cplex(Use)
cuts(OnOff) Dins DivingS(ome) DivingC(oefficient) DivingF(ractional)
DivingG(uided) DivingL(ineSearch) DivingP(seudoCost) DivingV(ectorLength)
feas(ibilityPump) flow(CoverCuts) gomory(Cuts) greedy(Heuristic)
heur(isticsOnOff) knapsack(Cuts) lagomory(Cuts) lift(AndProjectCuts)
local(TreeSearch) mixed(IntegerRoundingCuts) node(Strategy)
pivotAndC(omplement) pivotAndF(ix) preprocess probing(Cuts)
rand(omizedRounding) reduce(AndSplitCuts) residual(CapacityCuts) Rens Rins
round(ingHeuristic) sos(Options) two(MirCuts) Vnd(VariableNeighborhoodSearch)
Actions or string parameters:
allS(lack) barr(ier) basisI(n) basisO(ut) directory dualS(implex)
either(Simplex) end exit export gsolu(tion) help import initialS(olve)
max(imize) min(imize) para(metrics) primalS(implex) printM(ask) quit
saveS(olution) solu(tion) stat(istics) stop
Branch and Cut actions:
branch(AndCut) doH(euristic) prio(rityIn) solv(e)
The values of these parameters have values:
dualTolerance has value 1e-07
primalTolerance has value 1e-07
zeroTolerance has value 1e-20
allowableGap has value 0
integerTolerance has value 1e-06
preTolerance has value 1e-08
ratioGap has value 0
The only parameter which could be associated with the constraint tolerance and also consistent with my observations is the "integerTolerance".
So, I changed this tolerance to 1e-8 but got the same result (that is, the solution differed from the ground truth by more than 1e-7).
Questions: Can anyone shed some light on this? In particular, is there a way to set the constraint tolerance (the difference between a found solution and what we requested)? If not for CBC, do you know of any other solver (GLPK, Gurobi, etc.) where this quantity can be set?
Thanks.
Upvotes: 1
Views: 2695
Reputation: 155
At least in the latest pulp Version you can set it directly via parameter.
https://pythonhosted.org/PuLP/solvers.html
Parameter fracgap should do and does for me.
Upvotes: 1
Reputation: 1
I can't give you an exact answer, but I'd try primal or dual tolerance. Integer tolerance doesn't make sense for constraints to me.
Do you know how to change these options via the Python interface (I would like to experiment with it, but don't want to call the command line tool, and I'm not able to pass options to the solver) ?
Upvotes: 0