How Display some of 2 dimension parameter?

2019-07-29 03:46发布

I have a parameter t(i,j) , and set i,j /1*100/ , I want to display only positive t(I,j) .

My try

  Display$(t(I,j)>0), t;

I read following answer too Display only something

When I write my command like abow answer , I have error

  " uncontrolled set entered as constant "

What code should I write?

Thanks & Best

标签: gams-math
1条回答
成全新的幸福
2楼-- · 2019-07-29 04:42

The Display statement with with a symbol will always show the whole symbol. The $ condition you saw in the other post, can only be used to decide, if it should be displayed completely or not at all. You could define a second parameter with just the positive values and display it like this:

Set       i /1*100/,
          j /1*100/;
Parameter t(i,j);

t(i,j) = uniformInt(-50,50);

Parameter tPos(i,j);

tPos(i,j)$(t(i,j)>0) = t(i,j);

Display tPos;
查看更多
登录 后发表回答