Forum Discussion

FICO's avatar
FICO
Community Manager
9 years ago

Why Mosel result is not as optimal as Gams result?

Hi,

I use both Gams and FICO Mosel to solve the same model, but the result from Mosel is not as optimal as the result from Gams. What might cause this difference?

1. It's a MIP problem

2. Set the same max solving time, same relative target gap

3. All the input are read correctly

What else could affect the precision of the result?

Looking forward to your answers!

Best,

JW

7 Replies

  • FICO's avatar
    FICO
    Community Manager

    Hi JW,

    Are you using Xpress with GAMS as well? If so, are you using the same version of Xpress with both GAMS and Mosel? Is this also being executed on the same machine?

    For a MIP it is quite possible for the performance to change between major releases and some individual instances might get both worse and better due to perturbations introduced by a new version.

    Assuming the solver versions are the same and it is being executed on the same machine, it is still possible for GAMS and Mosel to produce slightly different versions of the same problem. For example, the constraints might appear in a different order in the final problem being passed to the solver. Such a small perturbation is often sufficient to send the solver down a different path, and especially for MIPs this can lead to quite different solve times.

    I suggest you try writing out the problems being created by both modeling languages, e.g. to an LP file format, where you can check for any differences.

    Best Regards,

    Michael

  • FICO's avatar
    FICO
    Community Manager

    Hi JW,

    In Mosel you should consider to change the following four parameters: MIPABSSTOP, MIPRELSTOP, MIPADDCUTOFF, MIPRELCUTOFF. Please have a look at the Optimizer documentation to get more information about those parameters. I usually choose the parameters as follows:

        setparam('XPRS_MIPABSSTOP', MY_MIPABSSTOP)     setparam('XPRS_MIPRELSTOP', MY_MIPRELSTOP)     setparam('XPRS_MIPADDCUTOFF', MY_MIPABSSTOP)     setparam('XPRS_MIPRELCUTOFF', MY_MIPRELSTOP)

    If you want to print or compare very small numbers, then you have to modify the Mosel 'zerotol' parameter. Please have a look at the Mosel documentation for more details about that Mosel parameter. Simply set the zerotol to zero if you work with numbers smaller than 1e-13. Note that the zerotol only affects number comparisons and number to text conversions. The actual numbers stored in memory are not affected by the zerotol, in particular Mosel does not round the numbers. Only the number to text conversion rounds the values.

        setparam('zerotol', 0)

    Regards,

    Johannes

  • FICO's avatar
    FICO
    Community Manager

    Thank you so much for your response!

    I am using Cplex with GAMS, that should be the main reason for the difference.

    Cplex gives me a better results than Xpress

  • FICO's avatar
    FICO
    Community Manager

    If you can post the solver output logs from your runs with GAMS and Mosel, it should be clear why one solver stopped with a different solution than the other. In Mosel you enable solver output using the call 'setparam("XPRS_VERBOSE", true)'.

    Did the Xpress-Mosel solve by any chance hit the time limit?

    If both solvers declared the problem optimal, are the final solutions at least within the relative MIP gap (defaults to 0.01%) of each other? In the case of the Xpress-Mosel solve, you should also be given a best bound on an optimal solution. Is the GAMS-Cplex solution between the best bound and best solution reported by Xpress?

    Best Regards,

    Michael

  • FICO's avatar
    FICO
    Community Manager

    Hello All. In a separate email thread we were able to get the .mps output from GAMS and solve with Xpress and get a good result. So we have narrowed down the most likely cause to be a difference between the Mosel model and the GAMS model i.e. the Mosel formulation being solved with Xpress is not the same as the GAMS formulation.

  • FICO's avatar
    FICO
    Community Manager

    Hi all, the problem has been solved with the help of FICO team!

    A parameter in objective function is not exactly the same in Mosel formulation and GAMS formulation. After modified the objective function, I got the same result now. Sometimes it’s hard to find a tiny difference, but with the help of FICO team, I got many great ideas how to compare GAMS model with Mosel model to identify the difference.

    Thank you so much [email protected] (https://community.fico.com/people/[email protected]) and the team for offering your assistance immediately. I really appreciate your expertise and enthusiasm to help me out and offer guidance and direction. FICO support team is always such a help!!! Looking forward to working with you as we move into next phase!

  • FICO's avatar
    FICO
    Community Manager

    Most welcome Jingwen. Many thanks to Baykal and Libin from the FICO pre-sales team for their debugging expertise.

    Glad we could help. We are delighted to have you all join the Xpress optimization family. Looking forward to the next phase and supporting you in the future.