Forum Discussion

FICO's avatar
FICO
Community Manager
10 years ago

ADDMIPSOL and XPRS_CB_SOLNOTIFY

Hi everyone,

I am looking for how to use "addmipsol" and find online the following example:

     public procedure solnotify(id:string, status:integer)

          writeln("Optimiser loaded solution ",id," status=",status)

     end-procedure

     addmipsol(id,heursol)

     setcallback(XPRS_CB_SOLNOTIFY,"solnotify")

I adapted this example to my code and it is working. The point is that the callback procedure prints a status equal to 3 and I could not find any reference to what it means. Does anyone has the specifications behind XPRS_CB_SOLNOTIFY.

Thanks for any help.

Bruno Fanzeres

3 Replies

  • FICO's avatar
    FICO
    Community Manager

    You might want to check the Xpress-Optimizer documentation. The details are described in the XPRSaddcbusersolnotify section:

    Status has one of the following values:

    0 Solution not checked. Likely because the MIP solve completed before the solution could be processed.

    1 Solution is feasible.

    2 Solution is feasible after reoptimizing with fixed globals.

    3 A local search heuristic was applied and a feasible solution discovered.

    4 A local search heuristic was applied but a feasible solution was not found.

    5 Solution is infeasible and a local search could not be applied.

    6 Solution is partial and a local search could not be applied.

    7 Failed to reoptimize the problem with globals fixed to the provided solution. Likely because a time or iteration limit was reached.

  • FICO's avatar
    FICO
    Community Manager

    Hi Bruno, and apologies for not linking "SOLNOTIFY" to "usersolnotify" in the documentation!

  • FICO's avatar
    FICO
    Community Manager

    You could extend the "solnotify" routine as follows:

    public procedure solnotify(id:string, status:integer)

      declarations

        SOLSTAT: array(range) of string

      end-declarations

      SOLSTAT:: (0..7)["Solution not checked",

        "Solution is feasible",

        "Solution feasible after reoptimizing with fixed globals",

        "Feasible solution discovered by local search heuristic",

        "Local search heuristic applied, no solution found",

        "Solution infeasible, local search not applied",

        "Partial solution, local search not applied",

        "Failed to reoptimize with globals fixed"]

      writeln("Optimiser loaded solution '", id, "' status: ", SOLSTAT(status))

    end-procedure