Search found 2 matches

by julianh96
1 year ago
Forum: Modeling
Topic: Count how many values in a row
Replies: 3
Views: 2876

Re: Count how many values in a row

Hi Michael, thanks for your respone. Unfortunately it doesn't work (probably because I don'T know how to use your answer ;-) ) Should I declare 'i' as a new set and M as a paramter? I tried several ways but couldn't fix it. I know that this is not an usual GAMS-topic, maybe it hepls if I explain why...
by julianh96
1 year ago
Forum: Modeling
Topic: Count how many values in a row
Replies: 3
Views: 2876

Count how many values in a row

[*] Hi, I just started using GAMS and need help regarding following issue: t /t1*t24/ b(t) is a binary variable. Now I want the variable s(t) to count how many times in a row b has been = 1. It should reset when b turns 0 again. For example: t b s t1 0 0 t2 1 1 t3 1 2 t4 0 0 t5 1 1 t6 1 2 t7 1 3 t8 ...