Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以直接比较 GAMS 中的两个向量?例如,
set i 'plants' /i0*i9/ parameter a(i),b(i); a(i)=uniformint(1,9); b(i)=uniformint(1,9); if(a(i)=b(i), display a; else display b; );
直接使用此代码将导致错误。但是,是否可以在我的 if 条件下使用两个向量的比较?谢谢,索菲亚
虽然您的条件表达式看起来正确,但i缺少一个循环。这可能如下所示:
i
Loop (i, if(a(i)=b(i), display a; else display b; ); );