$eolcom ! $Ontext Purpose: demonstrate use of BARON option 'numsol' to obtain the best numsol solutions of an optimization problem in a single branch-and-bound search tree. The model solved here is a linear general integer problem with 18 feasible solutions. BARON is run with a request to find up to 20 solutions. The model solved is the same as the one solved in gamslib/icut.gms. $Offtext set i index of integer variables / 1 * 4 / variables x(i) variables z objective variable integer variable x; x.lo(i) = 2; x.up(i) = 4; x.fx('2') = 3; ! fix one variable x.up('4') = 3; ! only two values equation obj obj definition; * pick an objective function which will order the solutions obj .. z =e= sum(i, power(10,card(i)-ord(i))*x(i)); model enum / all /; * instruct BARON to return numsol solutions $onecho > baron.opt numsol 20 gdxout multsol $offecho enum.optfile=1; option mip=baron, limrow=0, limcol=0, optca=1e-5, optcr=1e-5; solve enum minimizing z using mip; * recover BARON solutions through GDX set sol /multsol1*multsol100/; variables xsol(sol,i), zsol(sol); execute 'gdxmerge multsol*.gdx > %gams.scrdir%merge.scr'; execute_load 'merged.gdx', xsol=x, zsol=z; option decimals=8; display xsol.l, zsol.l;