I am working on a scheduling problem that is already coded in Pyomo. To solve the problem, I have used the NEOS solver, CPLEX. Now, to test and run some of the instances, I need to call some CPLEX internal options like, mipgap, branching priority, warm-start, solver log, etc. I also tried some functions to do this, but a few of them can work fine in a robust way, specifically, when needs to invoke the solution after the optimization terminates. The method I am currently using is something like this:

results = solver_manager.solve(m, solver = "cplex", tee= True, keepfiles=True, logfile = "log.txt", options_string="mipgap=0.1")

At the moment, this method can only handle solver = "cplex" and options_string="mipgap=0.1". Also, Pyomo documents contain cplex options, but it has not been mentioned (at least I can't find) how those can be applied when one would like to use NEOS. My question is, is there any robust way to use CPLEX internal options when it is called by NEOS?


1 Answer 1


Have you tried passing options using a dictionary like:

SolverManagerFactory('neos').solve(m, solver='cplex', options={'mipgap':0.1, 'other_option':'other_option_value'})

I tested this locally with Ipopt options that I'm more familiar with and it seemed to work. I don't use NEOS regularly so I'm not sure if there is a way to get the full solver log back from NEOS to confirm that specific options were set but I compared the solution and termination condition when running Ipopt locally and through NEOS.

  • $\begingroup$ thanks for your answer. I really had done it, but it made no sense and already throwing some errors. $\endgroup$
    – A.Omidi
    Apr 12, 2023 at 19:24
  • $\begingroup$ @A.Omidi Hi, did you find a way to pass options to neos solvers? $\endgroup$
    – Farshid
    Jul 14, 2023 at 2:52
  • $\begingroup$ @Farshid, unfortunately, I cannot find any related and also comprehensive documents for that, but as suggested by the answer, that is a well-known way to do it, you may define an option file and feeding that into the solver, and would hope it works. For mine, it only works for some of the general options. $\endgroup$
    – A.Omidi
    Jul 14, 2023 at 10:16
  • $\begingroup$ @A.Omidi Thanks for your response. Can you please elaborate more on how to define option file and pass it to the solver? O couldn't find anything on the option file either. Thanks. $\endgroup$
    – Farshid
    Jul 15, 2023 at 2:20
  • $\begingroup$ @Farshid, The way I have often used is something like what I mentioned in the question. results = solver_manager.solve(m, solver = "cplex", tee= True, keepfiles=True, logfile = "log.txt", options_string="mipgap=0.1"). But for example, I never get the log file by that, and this is still unclear for mine. $\endgroup$
    – A.Omidi
    Jul 15, 2023 at 4:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.