Using NEOS solvers in a script

1,073 views
Skip to first unread message

Bethany Nicholson

unread,
Feb 25, 2015, 11:58:49 PM2/25/15
to pyomo...@googlegroups.com
Is there a way to call NEOS solvers from a python script? I'm guessing it's just a matter of specifying the right options for the SolverFactory but I can't figure out what they are.

Bethany

Watson, Jean-Paul

unread,
Feb 27, 2015, 4:11:48 PM2/27/15
to pyomo...@googlegroups.com
There is a NEOS-specific solver manager, but that is about all I know. For example, if you run from the pyomo command line (which I realize you aren’t), you say something like “pyomo —solver-manager=neos —solver=cplex …”. 

Hopefully someone else knows more…

jpw


--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

William Hart

unread,
Feb 27, 2015, 4:15:29 PM2/27/15
to pyomo...@googlegroups.com
I'm sure I know, but I've forgotten.  Let me try to build a simple example ...

Daniel Friedrich

unread,
Mar 13, 2015, 5:52:56 PM3/13/15
to pyomo...@googlegroups.com
I was just looking into this and found the solution in the documentation; see code snippet. 

Cheers,
Daniel

Code snippet:

instance = model.create('test_pyomo.dat')

opt = SolverFactory("cbc")

solver_manager = SolverManagerFactory('neos')

results = solver_manager.solve(instance, opt=opt)

results.write()

Bill Hart

unread,
Mar 15, 2015, 2:42:22 PM3/15/15
to pyomo...@googlegroups.com
Thanks, Daniel!

mchehreg

unread,
Jun 26, 2015, 3:53:11 AM6/26/15
to pyomo...@googlegroups.com
Hi all, 

When I use Neos server to solve my MILP problem with cplex, as it's explained in this thread, I get the following error:

===============================
  results = solver_manager.solve(instance, opt=opt)
  File "C:\Anaconda\envs\env_pyomo\lib\site-packages\pyomo\opt\parallel\async_solver.py", line 33, in solve
    return self.execute(*args, **kwds)
  File "C:\Anaconda\envs\env_pyomo\lib\site-packages\pyomo\opt\parallel\manager.py", line 91, in execute
    results = self.wait_for(ah)
  File "C:\Anaconda\envs\env_pyomo\lib\site-packages\pyomo\opt\parallel\manager.py", line 156, in wait_for
    tmp = self.wait_any()
  File "C:\Anaconda\envs\env_pyomo\lib\site-packages\pyomo\opt\parallel\manager.py", line 145, in wait_any
    ah = self._perform_wait_any()
  File "C:\Anaconda\envs\env_pyomo\lib\site-packages\pyomo\neos\plugins\kestrel_plugin.py", line 122, in _perform_wait_any
    solver_results = self._opt.process_output(rc)
  File "C:\Anaconda\envs\env_pyomo\lib\site-packages\pyomo\opt\solver\shellcmd.py", line 228, in process_output
    results = self.results_reader(self.results_file, res=results, suffixes=self.suffixes)
  File "C:\Anaconda\envs\env_pyomo\lib\site-packages\pyomo\opt\plugins\sol.py", line 78, in __call__
    raise ValueError(msg)
ValueError: Error reading "c:\users\mc\appdata\local\temp\tmp2x9jbw.neos.sol": no Options line found.
SOL File Output:
ERROR: An error occured with your submission.

=============

In my log file, I get the following message: 

===============================
Job 3771867 submitted to NEOS, password='OvlqHczQ'
Check the following URL for progress report :
Job 3771867 dispatched
password: OvlqHczQ
---------- Begin Solver Output -----------
Job submitted to NEOS HTCondor pool.
=============

and when I check neos website with the given credentials to view job results, I get:

================================
Job 3771867 has finished.
Job 3771867 dispatched
password: OvlqHczQ
---------- Begin Solver Output -----------
Job submitted to NEOS HTCondor pool.
=============

Neos takes more than 30sec to solve the problem when I upload the LP model directly via its web interface. Any idea how I can fix this to get the result using pyomo's SolverManagerFactory interface?

Thanks a lot.
Reply all
Reply to author
Forward
0 new messages