I don't have a lot of experience using OPC CPLEX. I've just started to use it in the university few months ago. I'm duing an exercise and I need some help.
I have this vector: int RetrasosBultos with negative and positives values. And I want to convert the negatives values to 0.
How can I do that? I supose it must be easy, but I don`t know...
Pinned topic Convert negatives values to 0
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-12-11T13:46:37Z at 2012-12-11T13:46:37Z by SystemAdmin
SystemAdmin 110000D4XK1883 Posts
Re: Convert negatives values to 02012-12-11T13:46:37ZThis is the accepted answer. This is the accepted answer.Say that you have:
int a[i in I] = ...
then you could convert the negative values to 0 using the one line if syntax:
int b[i in I] = a[i] > 0 ? a[i] : 0;
The meaning of the instruction is simply: "if a[i] is greater than 0 then b[i] = a[i] else b[i] = 0".
StefanoUpdated on 2014-03-26T05:52:11Z at 2014-03-26T05:52:11Z by iron-man