9

I am sending a pretty complex Pyomo MINLP to NEOS using Couenne. I'm getting an error message that the solve time is too long (sorry, I don't have it still in my Python console). Is there a way to set a max time and return the best feasible result? I was able to get solutions back prior to adding my last set of constraints. Current code is:

# lots of code for model building...

solver_manager = SolverManagerFactory('neos')
results = solver_manager.solve(model , opt='couenne',load_solutions=True,tee=True)
model.solutions.store_to(results)
results.write()
Ralph
  • 371
  • 2
  • 5

1 Answers1

7

complex Pyomo MINLP to NEOS using Couenne.

So, I had to Google a bit to understand this part as I am not familiar with the package nor the NEOS service.

It would be beneficial as to where in the run-time progress you get the error message and what it exactly states.

From the NEOS webpage I found the following limitations

Retrieving results If you are having trouble receiving results, you should read the NEOS Server FAQ section on results before contacting support. Jobs that exceed the 8 hour time limit or the 3 GB memory limit will not return results.

I am guessing your model doesn't run for 8 hours, but maybe you are hitting the 3 GB memory limit before a solution has been found?

Edit below, as a comment shed some new light for the reason to the time limit (or I misunderstood the question).

If you simply want a feasible solution (fast), then I would model the problem as a decision problem (see this answer on Comp Sci SE).

Shortly put and in general terms, you change the problem from something like:

\begin{align} \min&\quad f(x) \\ \text{s.t.} &\quad Ax = b \\ &\quad x \in \Bbb R\end{align}

to

\begin{align} \min&\quad 0 \\ \text{s.t.} &\quad Ax = b \\ &\quad f(x)\leq K\\ &\quad x \in \Bbb R\end{align}

where $K$ is a large constant you are fairly certain a feasible solution has an objective less than (or Integer.MAX_VALUE or "large enough"). The problem should terminate as soon as a solution has been found.

Tue Christensen
  • 649
  • 5
  • 9
  • It may actually be taking that long. The issue is that I am willing to settle for a feasible solution, within a given time limit that I want to be able to specify. – Ralph Jun 03 '19 at 01:22
  • In that case I think you need to look at your Counne model to see if you can force it to run more frequent heuristics or maybe set an internal timelimit of e.g. 7 hours. This could force it to stop more gracefully and send the best solution back to you. I guess that if you hit the 8 hour limit then the server kills the process in brutal manner with no callback of the solution, but I don't know. – Tue Christensen Jun 03 '19 at 08:37
  • 1
    That's the point - I'm trying to pass a time limit as an argument to Couenne. For the purposes of this project, essentially any feasible solution will be fine, I am much more concerned about getting a fast feasible answer than the optimal answer. – Ralph Jun 03 '19 at 10:53
  • That seems to be something else than what you originally stated, so that would require a slightly different approach. I will make an edit for it. – Tue Christensen Jun 03 '19 at 10:57
  • Thanks Tue. I'll give that a shot. The issue is that there are many thousands (millions?) of feasible solutions. The objective function is nonlinear (constraints are linear / integer) so I think Couenne is spending way too much time searching the solution space for a global maximum when a local maximum will be generally acceptable. – Ralph Jun 03 '19 at 11:50
  • No problem. You could even consider ignoring the objective function, which would make the problem a MILP for which you might get better performance with respect to get any solution fast (depending on the solver). You could then simply calculate the nonlinear objective. – Tue Christensen Jun 03 '19 at 12:18
  • Following up the comment by @TueChristensen of ignoring the nonlinear objective and evaluating the objective, a way to do this algorithmically is using a feasibility pump algorithm for MINLP (the first iteration will do exactly that). Since you are using Pyomo-NEOS solver you should try using the solver DICOPT with the option " feaspump 1 ", which does exactly this and will give you efficiently feasible solutions. – David Bernal Jun 03 '19 at 20:46
  • @DavidBernal - can you provide a code snippet on how to pass that argument? I don't know how to pass solver arguments to NEOS through Pyomo. – Ralph Jun 03 '19 at 21:40
  • Since there is a 3GB limitation on RAM, can we have cases when running the cplex solver on NEOS is still more performant than running it on a personal computer with 8GB RAM ? Is there any advantages to use NEOS from a performance point of view ? – Antarctica Nov 18 '19 at 21:38