Thanks, now I am not getting that error, but now I am getting a
different error:
---------------------error-------------------------------
GLPK("C:\Documents and
Settings\Amit\Desktop\glpk-4.9\glpk-4.9\examples\"").solve(prob)
File "C:\Documents and Settings\Amit\Desktop\pulp\pulp.py", line 114,
in solve
return lp.solve(self)
File "C:\Documents and Settings\Amit\Desktop\pulp\pulp.py", line
1740, in solve
status = solver.actualSolve(self)
File "C:\Documents and Settings\Amit\Desktop\pulp\pulp.py", line 188,
in actualSolve
raise "PuLP: cannot execute "+self.path
PuLP: cannot execute C:\Documents and
Settings\Amit\Desktop\glpk-4.9\glpk-4.9\examples"
-------------------------------------------------------------
can anyone tell me where the problem is? I am using following code.
thanks
Amit
----------------------Code----------------------
from pulp import *
prob = LpProblem("linear", LpMinimize)
# Variables
x = LpVariable("x", 0, 4)
y = LpVariable("y", -1, 1)
z = LpVariable("z", 0)
# Objective
prob += x + 4*y + 9*z
# Constraints
prob += x+y <= 5
prob += x+z >= 10
prob += -y+z == 7
GLPK("C:\Documents and
Settings\Amit\Desktop\glpk-4.9\glpk-4.9\examples\"").solve(prob)
------------------------------------------------------------------------------
Robert Kern wrote:
am***********@gmail.com wrote:
Hi,
I am trying to run the following example which uses PULP for linear
optimization. But I am getting this error in the last line: "EOL while
scanning single quoted string".
GLPK("C:\Documents and
Settings\Amit\Desktop\glpk-4.9\glpk-4.9\examples\").solve(prob)
Backslashes escape characters in strings. Specifically, when a string uses ""
quotes as delimiters, then \" is the escape sequence for a double quote in the
string itself. The parser sees your \" at the end as simply an escaped double
quote and keeps interpreting the rest of the line as a string. Since the line
ends before another, unescaped " comes along, it raises the exception that you see.
http://docs.python.org/ref/strings.html
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco