See example:
Code: Select all
* Definitions
set i /i1/;
scalar pEnable /0/;
variable obj;
equation e1(i), e2(i);
$inlineCom { }
* Mathematical Formulation
e1(i){$pEnable}.. obj =e= 0;
e2(i).. obj =e= 0;
* Read range "pEnable" (specified from A1:D1) from "Exclude.xlsx" Excel-file that has the following content
* A1: pEnable
* B1: =
* C1: YES
* D1: ;
$call xls2gms m i="Exclude.xlsx" r1=pEnable o1=tmp_pEnable.txt
$include tmp_pEnable.txt
display pEnable;
* Model definition
$set SQUEEZELIST ""
$ifE pEnable=0 $set SQUEEZELIST %SQUEEZELIST% - e1
$log Building model with all %SQUEEZELIST%
model test / all %SQUEEZELIST% /;
solve test min obj using lp;
The display statement shows the correct value of "1".
As of my understanding, this might be because of compilation and execution time. Altough it says that xls2gms is run during compilation time, it does not set the value for pEnable.
Is there any solution to set the value of pEnable based on the value in the Excel-file to exclude the equation?
(I know the equation could be ignored with e1(i)$[pEnable], but I would prefer to not even include the equation if pEnable is set to 0 in the Excel-file).
Thanks.