Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import MOSEK from NEOS server #2867

Closed
ds2010 opened this issue Jun 7, 2023 · 6 comments · Fixed by #2870
Closed

Cannot import MOSEK from NEOS server #2867

ds2010 opened this issue Jun 7, 2023 · 6 comments · Fixed by #2870

Comments

@ds2010
Copy link

ds2010 commented Jun 7, 2023

Summary

Hello,

Recently, I noticed an error or a bug when I imported a solver like mosek from the NEOS server. But it is OK when I use the knitro or cplex solvers. I got the following error:
no Options line found. SOL File Output: ERROR: An error occured with your submission.

For your convenience, I used the ´transport.py´ as the demo. Please update the email address in the script.

Steps to reproduce the issue

$ python transport.py
# transport.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Import
from pyomo.environ import *
 
# Creation of a Concrete Model
model = ConcreteModel()
 
## Define sets ##
#  Sets
#       i   canning plants   / seattle, san-diego /
#       j   markets          / new-york, chicago, topeka / ;
model.i = Set(initialize=['seattle','san-diego'], doc='Canning plants')
model.j = Set(initialize=['new-york','chicago', 'topeka'], doc='Markets')
 
## Define parameters ##
#   Parameters
#       a(i)  capacity of plant i in cases
#         /    seattle     350
#              san-diego   600  /
#       b(j)  demand at market j in cases
#         /    new-york    325
#              chicago     300
#              topeka      275  / ;
model.a = Param(model.i, initialize={'seattle':350,'san-diego':600}, doc='Capacity of plant i in cases')
model.b = Param(model.j, initialize={'new-york':325,'chicago':300,'topeka':275}, doc='Demand at market j in cases')
#  Table d(i,j)  distance in thousands of miles
#                    new-york       chicago      topeka
#      seattle          2.5           1.7          1.8
#      san-diego        2.5           1.8          1.4  ;
dtab = {
    ('seattle',  'new-york') : 2.5,
    ('seattle',  'chicago')  : 1.7,
    ('seattle',  'topeka')   : 1.8,
    ('san-diego','new-york') : 2.5,
    ('san-diego','chicago')  : 1.8,
    ('san-diego','topeka')   : 1.4,
    }
model.d = Param(model.i, model.j, initialize=dtab, doc='Distance in thousands of miles')
#  Scalar f  freight in dollars per case per thousand miles  /90/ ;
model.f = Param(initialize=90, doc='Freight in dollars per case per thousand miles')
#  Parameter c(i,j)  transport cost in thousands of dollars per case ;
#            c(i,j) = f * d(i,j) / 1000 ;
def c_init(model, i, j):
  return model.f * model.d[i,j] / 1000
model.c = Param(model.i, model.j, initialize=c_init, doc='Transport cost in thousands of dollar per case')
 
## Define variables ##
#  Variables
#       x(i,j)  shipment quantities in cases
#       z       total transportation costs in thousands of dollars ;
#  Positive Variable x ;
model.x = Var(model.i, model.j, bounds=(0.0,None), doc='Shipment quantities in case')
 
## Define constraints ##
# supply(i)   observe supply limit at plant i
# supply(i) .. sum (j, x(i,j)) =l= a(i)
def supply_rule(model, i):
  return sum(model.x[i,j] for j in model.j) <= model.a[i]
model.supply = Constraint(model.i, rule=supply_rule, doc='Observe supply limit at plant i')
# demand(j)   satisfy demand at market j ;  
# demand(j) .. sum(i, x(i,j)) =g= b(j);
def demand_rule(model, j):
  return sum(model.x[i,j] for i in model.i) >= model.b[j]  
model.demand = Constraint(model.j, rule=demand_rule, doc='Satisfy demand at market j')
 
## Define Objective and solve ##
#  cost        define objective function
#  cost ..        z  =e=  sum((i,j), c(i,j)*x(i,j)) ;
#  Model transport /all/ ;
#  Solve transport using lp minimizing z ;
def objective_rule(model):
  return sum(model.c[i,j]*model.x[i,j] for i in model.i for j in model.j)
model.objective = Objective(rule=objective_rule, sense=minimize, doc='Define objective function')
 
 
## Display of the output ##
# Display x.l, x.m ;
def pyomo_postprocess(options=None, instance=None, results=None):
  model.x.display()
 
# This is an optional code path that allows the script to be run outside of
# pyomo command-line.  For example:  python transport.py
if __name__ == '__main__':
    # This emulates what the pyomo command-line tools does
    from pyomo.opt import SolverFactory, SolverManagerFactory
    import pyomo.environ, os
    #opt = SolverFactory("glpk")
    opt = SolverManagerFactory('neos')
    os.environ['NEOS_EMAIL'] = 'email@address'
    results = opt.solve(model, opt='mosek')
    #sends results to stdout
    results.write()
    print("\nDisplaying Solution\n" + '-'*60)
    pyomo_postprocess(None, model, results)

Error Message

$ ERROR: Error parsing NEOS solution file  NEOS log: Job 13114577 dispatched
password: rnacFLhx
    ---------- Begin Solver Output -----------
    Condor submit: 'neos.submit' Condor submit: 'watchdog.submit' Job
    submitted to NEOS HTCondor pool.
Traceback (most recent call last):
  File "/Users/dais2/Library/Python/3.9/lib/python/site-packages/pyomo/opt/plugins/sol.py", line 41, in __call__
    return self._load(f, res, soln, suffixes)
  File "/Users/dais2/Library/Python/3.9/lib/python/site-packages/pyomo/opt/plugins/sol.py", line 83, in _load
    raise ValueError("no Options line found")
ValueError: no Options line found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/dais2/Library/Python/3.9/lib/python/site-packages/pyomo/neos/plugins/kestrel_plugin.py", line 219, in _perform_wait_any
    solver_results = opt.process_output(rc)
  File "/Users/dais2/Library/Python/3.9/lib/python/site-packages/pyomo/opt/solver/shellcmd.py", line 396, in process_output
    results = self._results_reader(
  File "/Users/dais2/Library/Python/3.9/lib/python/site-packages/pyomo/opt/plugins/sol.py", line 45, in __call__
    raise ValueError(
ValueError: Error reading '/var/folders/gx/r24bylgj55j23qvhwk53qw7m0000gn/T/tmp6sydb5_p.neos.sol': no Options line found.
SOL File Output:
ERROR: An error occured with your submission.

ERROR: ERROR: An error occured with your submission.
Traceback (most recent call last):
  File "/Users/dais2/Downloads/transport.py", line 92, in <module>
    results = opt.solve(model, opt='mosek')
  File "/Users/dais2/Library/Python/3.9/lib/python/site-packages/pyomo/opt/parallel/async_solver.py", line 27, in solve
    return self.execute(*args, **kwds)
  File "/Users/dais2/Library/Python/3.9/lib/python/site-packages/pyomo/opt/parallel/manager.py", line 134, in execute
    raise ActionManagerError(
pyomo.opt.parallel.manager.ActionManagerError: Problem executing an event.  No results are available.

Information on your system

Pyomo version: 6.6.1
Python version:3.9.6
Operating system:macOS M1 pro
How Pyomo was installed (PyPI, conda, source): pip install pyomo
Solver (if applicable): NEOS

Additional information

@ds2010 ds2010 added the bug label Jun 7, 2023
@mrmundt
Copy link
Contributor

mrmundt commented Jun 7, 2023

@ds2010 - We are aware of the issue, and as far as we are aware, it is not a Pyomo problem. We reported the issue to NEOS, who replied that they had made some changes on their end.

@mrmundt
Copy link
Contributor

mrmundt commented Jun 7, 2023

#2839 <- We had to turn off our tests temporarily due to this exact issue.

@ds2010
Copy link
Author

ds2010 commented Jun 7, 2023

Thanks for your reply. Now I see. Hope they can fix it asap.

@mrmundt
Copy link
Contributor

mrmundt commented Jun 9, 2023

They sent us a response that said they think they fixed it, but my personal testing says otherwise. I replied to them as such and will let you know when I hear back.

@mrmundt
Copy link
Contributor

mrmundt commented Jun 13, 2023

@ds2010 - We received notification this morning that the problem should be resolved. I ran our test series locally to confirm.

@ds2010
Copy link
Author

ds2010 commented Jun 13, 2023

@mrmundt Thank you! I can also confirm that it works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants