Code: Select all
x.lo(i) = 1000;
Code: Select all
Equation xmin(i);
xmin(i) .. x(i) =g= 1000;
Code: Select all
x.fx('i0') = 777;
Code: Select all
Equation xinit;
xinit .. x('i0') =e= 777;
Moderator: aileen
Code: Select all
x.lo(i) = 1000;
Code: Select all
Equation xmin(i);
xmin(i) .. x(i) =g= 1000;
Code: Select all
x.fx('i0') = 777;
Code: Select all
Equation xinit;
xinit .. x('i0') =e= 777;
Code: Select all
Set j / j1*j10 /;
Parameter a(j);
a(j) = uniform(1,10);
Variables x(j), z;
Equations f(j), obj;
obj.. z =e= sum{j, power(x(j)-4,2)};
f(j).. x(j) =e= a(j);
model foo / obj /
bar / obj, f /;
* This model has many constraints, many free variables
* The solver has freedom in presolving/removing them (if it can) or not
* In the listing, the nonzero marginals are on the equation f(j)
solve bar using nlp minimizing z;
* This model has one constraint, many variables
* The solver has freedom in presolving/removing them (if it can) or not
* In the listing, the nonzero marginals are on the variables x(j)
x.fx(j) = a(j);
solve foo using nlp minimizing z;
* With holdfixed on, the solver sees only one constraint, one variable
* It doesn’t even know the variable x exists
* In the listing, you won’t see any marginals for x, since the solver never saw x
x.m(j) = 0;
foo.holdfixed = 1;
solve foo using nlp minimizing z;