Forum Discussion

FICO's avatar
FICO
Community Manager
4 years ago

Hello all! My question is: how can I check the computation time and optimality gap in a nonlinear model (using "mmxnlp")? Thank you :)

1 Reply

  • FICO's avatar
    FICO
    Community Manager

    You can use Mosel's 'gettime' function to measure solve time, for example:

    uses "mmxnlp", "mmsystem"
     
    (...model statement...)
     
    stime:=gettime
    minimize(myobj)
    writeln("Total solve time: ", gettime-stime, " sec")

    For MIP problems you can calculate the gap value from solver parameters:

    uses "mmxprs"
     
    (...state and solve the problem...)
      
    mipobj:= getparam("XPRS_MIPOBJVAL")
    bbound:= getparam("XPRS_BESTBOUND")
    relgap:= abs( (mipobj-bbound)/mipobj )

    For general NL problems solved with local solvers, I don't think that you can obtain any really meaningful 'bestbound' value.