BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
carlosmirandad
Obsidian | Level 7

Hi,

 

Is there a way to configure proc optmodel to gracefully exit (and save the solutions that it has found so far) when it runs out of memory?

 

I am solving a binary linear model with the MILP solver.  The relaxed problem finishes quickly but the branch and cut algorythm is getting stuck. After many iterations (1.5 days runing) the algorythm runs out of memory and terminates without saving the 7 solutions that it had found up to that point.  The gap was not small (~35%) so I may not want to use any of those solutions anyway, but I would like to see the best one, at the very least.  Unfortunatelty, the solver is terminating with status "OUT_OF_MEMORY", solution status "OUTMEM_NOSOL", and the create data statements saves zero (0) observations.

 

Here are some questions that come to mind in this situation:

  • Is there an option for me to tell optmodel to save the best integer solution found (despite this exit status)?
  • Or what could I do to have proc optmodel save a solution every "x" iterations or every "x" hours? e.g. gracefully exit solver with a timeout (I could use maxtime for that), save the best integer solution, and then continue solving from that same point (without having to start over again from the root of the search tree.)  I could include this in a loop, so that not everything is lost if we suddenly hit a "out of memory" error... but this only makes sense if there is a way to continue with the branching and cutting seamlesly. 
  • Or is there a way to tell OPTMODEL to save the search tree in disk so that it never runs out of memory?  FYI I am using the system options to increase memory and cpu (-memsize 4096M -cpucount 8.)  According to the log, SAS is getting this amount of memory and the Branch and Cut algorithm is taking advantage of all 8 processors.  It seems to me that, if there was a way for optmodel to use disk when the tree becomes very large, this amount of memory could be enough... and solving the problem would be just a matter of waiting longer, solving just to 90%, etc.

Of course, I am also tweaking the solver options (probe, nodesel, cutting plane levels, etc.) to see if there is a way to converge faster to the solution. So far, all the runs are ending up in a similar way. I am attaching the SAS log produced by the SOLVE statement in one of those runs.  It would be nice to be able to see what are the options producing (hence this question.)  Since the question is not specific to this particular problem, I am not including the model code itself, but let me know if any other information would help.

 

Would appreciate any pointers!

1 ACCEPTED SOLUTION

Accepted Solutions
RobPratt
SAS Super FREQ

This issue was inadvertently introduced in SAS/OR 14.1 and will be fixed in the next release.  Until then, a workaround is to replace the SOLVE statement with the following statements:

 

      save mps mpsdata;
      submit;
         proc optmilp data=mpsdata primalout=primalout;
         run;
      endsubmit;
      read data primalout into [_N_] _VAR_[_N_]=_VALUE_;

You can add any solver options to the PROC OPTMILP statement.

 

If you would like assistance reducing the solve time for your specific problem, please post more details, preferably including code and data.

View solution in original post

2 REPLIES 2
RobPratt
SAS Super FREQ

This issue was inadvertently introduced in SAS/OR 14.1 and will be fixed in the next release.  Until then, a workaround is to replace the SOLVE statement with the following statements:

 

      save mps mpsdata;
      submit;
         proc optmilp data=mpsdata primalout=primalout;
         run;
      endsubmit;
      read data primalout into [_N_] _VAR_[_N_]=_VALUE_;

You can add any solver options to the PROC OPTMILP statement.

 

If you would like assistance reducing the solve time for your specific problem, please post more details, preferably including code and data.

carlosmirandad
Obsidian | Level 7
Thanks Rob. Appreciate the prompt response.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1770 views
  • 1 like
  • 2 in conversation