Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Writing solution information to file in CPLEX

2 views
Skip to first unread message

Chris

unread,
May 14, 2008, 2:34:10 PM5/14/08
to
I have some integer programming problems (minimization) that require
several days of computing time. I am solving the problems to
optimality and I periodically write the optimal solution in .mst and/
or .sol format. These files contain the current optimal solution, but
apparently contain no information about the best lower bound. So if I
stop the current run, write the solution, restart and then load in the
solution, I am often left with a larger gap than when I stopped. Is
there any way to save lower bound information as well? I looked
through the CPLEX 11.0 documentation and can't find anything. I
realize that the files may become large as parts of the search tree
may have to be stored, but that may be ok in this case. Thanks for any
advice.

Chris

sunn...@gmail.com

unread,
May 14, 2008, 7:59:54 PM5/14/08
to
Hello Chris,
You can try writing to a log file. I believe this will tell you the
best bound information: set logfile <filename.log>

Chris

unread,
May 14, 2008, 9:15:57 PM5/14/08
to
On May 14, 7:59 pm, sunny3...@gmail.com wrote:
> Hello Chris,
> You can try writing to a log file. I believe this will tell you the
> best bound information: set logfile <filename.log>
>
Thanks for the idea. I know that I can use a logfile, but what I want
to do is interrupt the solving process at some stage, write
information about the current best integer solution AND the best lower
bound so that I can pick up where I left off with the upper and lower
bounds. For example, I just ran CPLEX for 3 hours and the best
solution did not change, but the gap went from 30% to 5%. I wrote
a .mst and .sol file after the three hours, but when I load either of
these files and begin again, I start out with the 30% gap once again,
basically wasting all of the work required to establish the lower
bound. Hope this clears up what I'm trying to do. This is an
academic exercise, so I am interested in proving optimality. Thanks!

Chris

Chris

unread,
May 14, 2008, 9:16:07 PM5/14/08
to
On May 14, 7:59 pm, sunny3...@gmail.com wrote:
> Hello Chris,
> You can try writing to a log file. I believe this will tell you the
> best bound information: set logfile <filename.log>
>

Paul Rubin

unread,
May 15, 2008, 10:41:14 AM5/15/08
to

Assuming that you are using a callback to write the current incumbent,
you can invoke the getBestObjValue method inside the callback and write
that someplace (probably in a separate file, maybe as a comment inside
the .mst/.sol file if they allow comments). Before restarting, you can
set the CutLo (max problem) or CutUp (min problem) parameter to the
recorded bound.

/Paul

Chris

unread,
May 15, 2008, 1:34:12 PM5/15/08
to

Great. That's just what I needed. I'm actually not using a callback
but this will
be easy enough to incorporate. Thanks for the idea

Chris

ol...@yahoo.com

unread,
May 15, 2008, 1:35:18 PM5/15/08
to
What you need to pick up the solution process again is not just the
bound, but the entire tree. Having just a bound is not enough
information for the solver to continue the solution process, it needs
to know how this bound was obtained. Cplex 9 (and earlier) had a
method to save the current tree to a file, then load it again and pick
up where it was stopped. Unfortunately this functionality was removed
in later releases, and there is no other method that would achieve
this.
Use Cplex 9, or as far as I know Xpress MIP allows you to save the
tree.

Paul Rubin

unread,
May 15, 2008, 1:59:32 PM5/15/08
to
Paul Rubin wrote:
Before restarting, you can
> set the CutLo (max problem) or CutUp (min problem) parameter to the
> recorded bound.
>

Sorry, scratch this part. You would use the incumbent solution, not the
best bound, as CutLo or CutUp. My bad.

/Paul

Chris Groer

unread,
May 15, 2008, 10:46:22 PM5/15/08
to
Yep, it doesn't work. I just got around to tinkering with this and there
seems to be no way to do what I want. I guess I'll just have to run it over
night and hope I reach optimality. I wonder why this capability was removed
in 10 & 11? For some applications it is nice - let the solver run while you
don't need your CPU for awhile, write the tree, do something else, load the
tree, run it, etc. Guess I'll just start back up with my best solution and
a bad lower bound... Thanks for the ideas anyway.

Chris

"Paul Rubin" <ru...@msu.edu> wrote in message
news:YR_Wj.150$Q57...@nlpi065.nbdc.sbc.com...

thy...@gmail.com

unread,
May 16, 2008, 11:03:32 AM5/16/08
to
On May 15, 10:46 pm, "Chris Groer" <cgr...@gmail.com> wrote:
> Yep, it doesn't work. I just got around to tinkering with this and there
> seems to be no way to do what I want. I guess I'll just have to run it over
> night and hope I reach optimality. I wonder why this capability was removed
> in 10 & 11? For some applications it is nice - let the solver run while you
> don't need your CPU for awhile, write the tree, do something else, load the
> tree, run it, etc. Guess I'll just start back up with my best solution and
> a bad lower bound... Thanks for the ideas anyway.
>
> Chris

The following solution assumes you're on a Linux/UNIX environment. If
you're not, you should probably consider switching anyway:
If what you want is just to stop the cplex process for a while in
order to do something else and then return to solving, you can suspend
the cplex process by typing Ctrl+Z on the terminal from which you
started it (this will send it a STOP signal). Then, when you're ready
to let it go again, go to the same terminal and type "fg" (without the
quotes) followed by ENTER. If you don't have the terminal window that
started the process open any more, locate the process id (using "top"
or "ps") and do this:

To stop, use the command: kill -STOP pid
To re-start, use the command: kill -CONT pid

where pid is the process id of the cplex process.

Tallys

0 new messages