Correct. I did not see the declaration "Positive variables f(i,p1)". Change this to "Positive variables f(i,i)". Since you use the variable f only over p1 there is no difference.
-Michael
Search found 1038 matches
- 1 year ago
- Forum: Modeling
- Topic: How to create a random subset with/without replacement and run model multiple times
- Replies: 4
- Views: 1910
- 2 years ago
- Forum: Modeling
- Topic: How to create a random subset with/without replacement and run model multiple times
- Replies: 4
- Views: 1910
Re: How to create a random subset with/without replacement and run model multiple times
Here is only the loop with the random selection of p1:
-Michael
Code: Select all
scalar adr;
loop(k,
option clear=p1;
while(card(p1)<>50, adr = UniformInt(0,99); loop(i$(ord(i)=1), p1(i+adr) = yes));
solve m using nlp minimizing z1;
);
- 2 years ago
- Forum: Tools
- Topic: variety of solutions in one GDX/Excel Sheet
- Replies: 3
- Views: 4670
Re: variety of solutions in one GDX/Excel Sheet
Why does the solution proposed in my previous answer not work for you? -Michael
- 2 years ago
- Forum: Tools
- Topic: variety of solutions in one GDX/Excel Sheet
- Replies: 3
- Views: 4670
Re: variety of solutions in one GDX/Excel Sheet
If you already have a loop, copy the solution into a report parameter with an additional index (the loop index) and then export the GDX/Excel:
-Michael
Code: Select all
...
set s / s1*s10/; parameter xl(s,i,j);
loop(s,
solve mymodel min z us lp;
xl(s,i,j) = x.l(i,j);
);
execute_unload 'allsol', xl;
- 2 years ago
- Forum: Modeling
- Topic: Water pump scheduling Model
- Replies: 6
- Views: 2289
Re: Water pump scheduling Model
I think the second term in the objective needs a set of ():
-Michael
Code: Select all
amac.. z =e= sum((p,s), M(s)*(0.056195*(15000*Hpompalanan(p,s)/6))- (Edr(s)*G(s)-Edr(s)*Mdagitim(s)));
- 2 years ago
- Forum: Modeling
- Topic: GAMS takes a long time to return infeasibility for a certain parameter
- Replies: 2
- Views: 1279
Re: GAMS takes a long time to return infeasibility for a certain parameter
A MIP solver can often detect the infeasibility of an instance in the presolve step. This goes usually very quickly. If the infeasiblity cannot be determined by presolve and the underlying LP relaxations are feasible than B&C kicks in and this can take a long time. Theoretically, determining if ...
- 2 years ago
- Forum: Modeling
- Topic: Dual infeasible due to empty column 'Gamma'.
- Replies: 1
- Views: 1138
Re: Dual infeasible due to empty column 'Gamma'.
First solve as rMIP (message "Model has an unbounded ray") and then set a bound on the objective to prevent unboundedness (Gamma.lo = -1e6;) now check your runaway variables (Pj h1 .Microturbine) and see why this variable is not bounded by your logic. Fix it!
-Michael
-Michael
- 2 years ago
- Forum: Modeling
- Topic: Water pump scheduling Model
- Replies: 6
- Views: 2289
Re: Water pump scheduling Model
Your GAMS program compiles and executes. It creates an LP that even solves to optimality. You say that the objective does not make sense. You are the only one who can debug this. What do you expect? Why does the model not give you the answers you want. This is called model debugging and requires a d...
- 2 years ago
- Forum: Modeling
- Topic: coefficient mismatch
- Replies: 2
- Views: 10323
Re: coefficient mismatch
You correctly pick the i=5 with $(ord(i)=6. Why do you expect that the ord(t) starts with 0? If you want the t "value", then either use (ord(t)-1) or t.val:
-Michael
Code: Select all
obj(i)$(i.val=5).. Z =e= sum(t, x(i,t)*t.val);
- 2 years ago
- Forum: Syntax
- Topic: Saving result on MAC
- Replies: 7
- Views: 3023
Re: Saving result on MAC
Just add them as columns:
-Michael
Code: Select all
fuel,scen,2017,2018
Gas1,Scen1,9.79,10.01
Gas1,Scen2,9.79,10.02
Gas1,Scen3,9.89,10.03
...