0

When we have defined a relatively complicated model, the solving process could be long.

One way is to cut the long solving process into phases. We can find a quick and feasible solution first with an initial objective, AND then resume the solving process with an adjusted objective.

In order to do this, we have to know how to pause & resume the solving process and pass the latest model state to the next solving phase.

We understand we could set the time limit by:

solver.parameters.max_time_in_seconds = 1.0

However, when we rerun:

status = solver.Solve(model=model)

It seems it is RE-RUNNING but not resuming the solving process.

How could we save the state of the model and resume the model solving. Thanks.

Ken White
  • 123,280
  • 14
  • 225
  • 444
John
  • 1,779
  • 3
  • 25
  • 53

1 Answers1

1

Solve() is stateless. You can pass a previous solution wish solution_hints or plain constraints.

Presolve is an important, expensive and necessary step in solving optimization/satisfiability problems. For this reason, you cannot change the objective on the fly.

Note, you have a parameter stop_after_first_solution that will do just what it says, instead of a time limit.

Laurent Perron
  • 8,594
  • 1
  • 8
  • 22