I am trying to solve Linear Programing Problem through PuLP in pyhthon. I have declared the problem (by name prob) without any error:
MAXIMIZE
20*x1 + 30*x2 + 0
SUBJECT TO
_C1: x1 + 2 x2 <= 100
_C2: 2 x1 + x2 <= 100
VARIABLES
x1 Continuous
x2 Continuous
But now when I try to solve it, it is giving me an error
Here is what I typed:
prob.solve()
And here is the error I am getting
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-7-613465fcbb4d> in <module>
----> 1 prob.solve()
~\Anaconda3\lib\site-packages\pulp\pulp.py in solve(self, solver, **kwargs)
1662 #time it
1663 self.solutionTime = -clock()
-> 1664 status = solver.actualSolve(self, **kwargs)
1665 self.solutionTime += clock()
1666 self.restoreObjective(wasNone, dummyVar)
~\Anaconda3\lib\site-packages\pulp\solvers.py in actualSolve(self, lp, **kwargs)
1360 def actualSolve(self, lp, **kwargs):
1361 """Solve a well formulated lp problem"""
-> 1362 return self.solve_CBC(lp, **kwargs)
1363
1364 def available(self):
~\Anaconda3\lib\site-packages\pulp\solvers.py in solve_CBC(self, lp, use_mps)
1418 log.debug(self.path + cmds)
1419 cbc = subprocess.Popen((self.path + cmds).split(), stdout = pipe,
-> 1420 stderr = pipe)
1421 if cbc.wait() != 0:
1422 raise PulpSolverError("Pulp: Error while trying to execute " + \
~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
773 c2pread, c2pwrite,
774 errread, errwrite,
--> 775 restore_signals, start_new_session)
776 except:
777 # Cleanup if the child failed starting.
~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
1176 env,
1177 os.fspath(cwd) if cwd is not None else None,
-> 1178 startupinfo)
1179 finally:
1180 # Child is launched. Close the parent's copy of those pipe
FileNotFoundError: [WinError 2] The system cannot find the file specified
sudo pulptestand try running your code again?[WinError 2] The system cannot find the file specified * Solver <class 'pulp.solvers.PULP_CBC_CMD'> failed. Solver <class 'pulp.solvers.CPLEX_DLL'> unavailableAnd so on. Any idea how to solve this?