# GAMS Support Wiki

### Site Tools

solver:how_do_i_fix_a_semiint_cont_variable

# Differences

This shows you the differences between two versions of the page.

 solver:how_do_i_fix_a_semiint_cont_variable [2010/05/19 11:07]support — (current) Both sides previous revision Previous revision 2021/03/12 20:39 Atharv Bhosekar removed2010/05/19 11:07 support 2010/05/19 11:07 support 2010/05/19 11:04 support created Next revision Previous revision 2021/03/12 20:39 Atharv Bhosekar removed2010/05/19 11:07 support 2010/05/19 11:07 support 2010/05/19 11:04 support created Line 1: Line 1: - ====== How do I fix a semiint/​cont Variable? ====== - A "​fixed"​ semicont variable has still the implicit lower bound of 0.  In order to truly fix it the variable needs to be relaxed via RMIP or to add to attribute ''​prior=INF''​. The example below illustrates this. - - <​code>​ - variable x,z; - semicont variable x; - equation e; - e.. z =e= x; - model m /all/; - - * A "​fixed"​ semicont variable has still the implicit lower bound of 0 - * The domain for x is {0,1} - x.fx=1; solve m us mip min z; abort\$(abs(z.l-0)>​1e-6) 'wrong obj'; - - * In order to truly fix it the variable needs to be relaxed via RMIP or prior=INF - * Solved as an RMIP the domain of x becomes {1} - x.fx=1; solve m us rmip min z; abort\$(abs(z.l-1)>​1e-6) 'wrong obj'; - - * Solved as a MIP with x.prior=INF the domain of x becomes also {1} - x.fx=1; x.prior=INF;​ solve m us mip min z; abort\$(abs(z.l-1)>​1e-6) 'wrong obj'; - - * Since x is not truly fixed (domain is {0,1}) holdfixed does not "​hold"​ x - x.fx=1; m.holdfixed=1;​ solve m us mip min z; abort\$(m.numvar<>​2) 'x hold incorrectly';​ - - * Holdfixed does not "​hold"​ semicont variables even if they are relaxed and truely fixed - x.fx=1; m.holdfixed=1;​ solve m us rmip min z; abort\$(m.numvar<>​2) 'x hold incorrectly';​ - - * Holdfixed does not "​hold"​ semicont variables even if they are relaxed and truly fixed - x.fx=1; x.prior=INF;​ m.holdfixed=1;​ solve m us mip min z; abort\$(m.numvar<>​2) 'x hold incorrectly';​ -
solver/how_do_i_fix_a_semiint_cont_variable.1274260063.txt.gz ยท Last modified: 2010/05/19 11:07 by support