4 Replies - 937 Views - Last Post: 26 February 2011 - 08:10 PM Rate Topic: -----

#1 noctolater   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 72
  • Joined: 29-April 09

How To Save A Running Process

Posted 26 February 2011 - 02:47 PM

I am trying to teach myself more about NP complete problems, and how to solve them. Obviously, this means I will need to run programs for a VERY long time. As such, I have been trying to figure out how to stop a program in the middle of running, and resume from that point later. I have been using recursive methods to explore down the various trees for the various problems, but I have not been able to figure out a good method to stop at a random point, halfway down a tree, and start again at a later time. Can anyone point me in the direction of further reading on this topic, or examples of others accomplishing the same objectives? I greatly appreciate any help you can provide me in this matter, and thank you for you time.

Is This A Good Question/Topic? 0
  • +

Replies To: How To Save A Running Process

#2 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12360
  • View blog
  • Posts: 45,474
  • Joined: 27-December 08

Re: How To Save A Running Process

Posted 26 February 2011 - 03:03 PM

If you are using a physical Tree structure, you could create an Iterator for it. As the problem grows though, this will be very memory intensive to manage the Tree.
Was This Post Helpful? 0
  • +
  • -

#3 cfoley   User is offline

  • Cabbage
  • member icon

Reputation: 2391
  • View blog
  • Posts: 5,016
  • Joined: 11-December 07

Re: How To Save A Running Process

Posted 26 February 2011 - 03:53 PM

1. Implement a way of pausing and continuing your calculation.
2. If your algorithms are nicely object orientated you should be able to save their state through serialisation with a little effort. http://download.orac...cts/serial.html
3. If your algorithm is a horrible procedural mess, you've just learned one reason why you should use an OO design when programming in Java. Refactor it so you can serialise the parts you need.

However, before you do any of this, have you considered simply hibernating your computer instead of turning it off?
Was This Post Helpful? 2
  • +
  • -

#4 noctolater   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 72
  • Joined: 29-April 09

Re: How To Save A Running Process

Posted 26 February 2011 - 08:07 PM

Since the projects are of such a massive size, I am also implementing multi thread support, and distributive computing support. As such, to be able to save the state and start again later would be nice since it will be run on every computer I can con someone into running it on :P I am using a recursive function that takes in two ArrayLists and progresses down the tree by moving one Object from one ArrayList to the other, then removing it after the recursive call is done, and moving onto the next element. As I cannot conceive of a way to serialize this without losing the recursion, would you be kind enough to point me in the direction of a good object oriented design tutorial and/or book? Thank you so much for your responses.
Was This Post Helpful? 0
  • +
  • -

#5 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12360
  • View blog
  • Posts: 45,474
  • Joined: 27-December 08

Re: How To Save A Running Process

Posted 26 February 2011 - 08:10 PM

View Postmacosxnerd101, on 26 February 2011 - 05:03 PM, said:

If you are using a physical Tree structure, you could create an Iterator for it. As the problem grows though, this will be very memory intensive to manage the Tree.

I think this is the concept you are looking for, but it might require some adaptation for your uses. Essentially, my Tree Iterator uses a StackMap to determine which "call" should occur next, as well as the previous calls. So you can control Tree traversal.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1