Python, pulp, can't set external solver

Hi
Before the most resent update of Rhino I was able to use a different solver with pulp.
Now it throws the error below
Note it still works with the build in solver (PULP_CBC_CMD)
Can you help me out?

# r: pulp
from pulp import *

# Some problem from the pulp documentation page
prob = LpProblem("The Whiskas Problem", LpMinimize)

x1 = LpVariable("ChickenPercent", 0, None, LpInteger)
x2 = LpVariable("BeefPercent", 0)

prob += 0.013 * x1 + 0.008 * x2, "Total Cost of Ingredients per can"

prob += x1 + x2 == 100, "PercentagesSum"
prob += 0.100 * x1 + 0.200 * x2 >= 8.0, "ProteinRequirement"
prob += 0.080 * x1 + 0.100 * x2 >= 6.0, "FatRequirement"
prob += 0.001 * x1 + 0.005 * x2 <= 2.0, "FibreRequirement"
prob += 0.002 * x1 + 0.005 * x2 <= 0.4, "SaltRequirement"

# Setting the solver to HiGHS now throws an error
path_highs = "/opt/homebrew/Cellar/highs/1.6.0/bin/highs"
solver_HiGHS = HiGHS_CMD(path=path_highs, timeLimit=30)
solver_CBC = PULP_CBC_CMD(timeLimit=30)
c = prob.solve(solver_HiGHS)
#c = prob.solve(solver_CBC)

I can replicate and will get it fixed. Odd that is was working before :thinking: It might have been a change to pulp as well I think since # r: pulp always gets the latest?! I am fixing it either way. Great catch.

RH-81299 Python 3 stream wrapper does not have .fileno() method

1 Like

Hi Ehsan
Perfect. thank you!

1 Like