I’m running jsprit on Google Compute Engine’s Preemptible VM instances. This means that the VM instance can be shut down at any time. When preemption happens the VM instance will receive a soft off signal and after 30 seconds it will shutdown.
The potential issue here is that when jsprit is still in the process of solving the vrp and preemption happens everything will be lost.
I’ve added a shutdown hook to my code, so when it receives a shutdown event, it will run that code. Here’s what it looks like:
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
// 1) Tell jsprit to stop and return the current best solution
// 2) Store current best solution somewhere
// 3) Shut down
}
});
What I’m looking for is a way to tell jsprit to stop and return the current best solution. Is this possible?
Unfortunately premature termination does not give me the option to stop jsprit at any time I want (in this case when a shutdown event happens). Premature termination gives you the option for jsprit to terminate based on time itreations, variation coefficient.