Skip to content

Commit

Permalink
MOSEK: timelim option
Browse files Browse the repository at this point in the history
Fixes many end2end tests for MOSEK, as the scripts assume this option
  • Loading branch information
glebbelov committed Sep 2, 2022
1 parent 765b64b commit d0d6270
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions solvers/mosek/mosekbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ void MosekBackend::InitCustomOptions() {
"Which algorithm to use for non-MIP problems or for the root node of MIP problems:\n"
"\n.. value-table::\n", MSK_IPAR_OPTIMIZER, alg_values_method, 2);

AddSolverOption("lim:time timelim timelimit",
"Limit on solve time (in seconds; default: no limit).",
MSK_DPAR_OPTIMIZER_MAX_TIME, 0.0, DBL_MAX);

// Example of stored option, to be acted upon in the driver code
AddStoredOption("tech:exportfile writeprob writemodel",
"Specifies the name of a file where to export the model before "
Expand Down
3 changes: 3 additions & 0 deletions test/end2end/scripts/python/AMPLRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ def _run(self, model: Model, logFile : str = None):
print("Solving... ", end="")
t.tick()
self._ampl.solve()
solve_result = self._ampl.get_value("solve_result")
if solve_result != "solved":
print("WARNING: not solved (solve_result: {})".format(solve_result))
amplStats["AMPLsolveTime"]= t.toc()
self.stats["AMPLstats"] = amplStats
interval = self._ampl.getValue("_solve_elapsed_time")
Expand Down

0 comments on commit d0d6270

Please sign in to comment.