Hi everyone!

I would like to generate all feasable solution which their gap is within 0.1% and 0.2%. Is-it possible?! How could I implement this algoritm. I would like to record and export every solution on .txt folder.

I tried to develop something like.

*forall(i in Iteration) do*

* mipObjVal := getparam("XPRS_MIPOBJVAL")*

* bestBound := getparam("XPRS_BESTBOUND")*

* gap := abs((mipObjVal- bestBound)*100/mipObjVal )*

*if gap<=0.1 then*

*fopen("C:\\Blending-network\\Solution_Modele_1.txt",F_OUTPUT+F_APPEND)*

*my_output:=getfid(F_OUTPUT)*

*fselect(my_output)*

*writeln("Global Cost :\t", getsol(fonction1),"\t","$")*

* *

* fclose(F_OUTPUT)*

*end-do*

*end-if*

However, this algorithm generate only one best solution! Could anybody help me pliiizz!

Many thanks !!!

You could try to use the solution enumerator functionality to produce a larger number of solutions - although possibly not 'all solutions' (unless your problem is entirely discrete there could actually be an infinite number of solutions.)

Given that Mathematical Optimization tries to determine the best solution, the default algorithm settings of Xpress Optimizer usually cut off many intermediate solutions, the solution enumerator reconfigures certain settings to obtain a larger number of alternative solutions, typically at the expense of longer running times. With Mosel, it is enabled by using the option XPRS_ENUM in the call to minimize/maximize, see for example FICO Xpress Optimization Examples Repository: Folio - Advanced modelling and solving tasks

Regarding the saving of alternative solutions: when started from Mosel, the solution enumerator enables the 'solution pool' to save up to a specified number of alternative solutions that can be retrieved after the optimization run via 'selectsol' (see chapter 'mmxprs' of the Mosel Reference Manual).

Alternatively (independent of whether you use the solution enumerator or standard search) you can define the INTSOL callback to display or save each solution at the point where it is found. You could combine this with the GAPNOTIFY callback to trigger saving of solutions only once the desired MIP gap has been reached. The use of these 2 callbacks is shown in this example: FICO Xpress Optimization Examples Repository: Cut generation for an economic lot-sizing (ELS) problem