0
A - B
0   1  - new connection
0   0  - unchanged 
1   1  - unchanged
1   0  - disruption

I'm working on an industrial engineering modelling/coding project. I facing with data processing problem about the sample data above in an GAMS code.

I need a mathematical way of finding 1-0 patterns(which means disruptions in my model). I cannot use logical statements, like if, as they will affect my model and make it non-linear.

I tried

sum(i,a(i)-b(i))

it returned 0 as all the values cancelled each other. I need a pure mathematical expression to detect disruptions. Any ideas?

EDIT:Absolute value is also not acceptable.

ANSWER: After few hours of playing with numbers I came up with the following:

{ (a(i) + b(i)) - (a(i) * b(i)) - b(i) }

Thanks everyone for their contributions

4

2 回答 2

0

This should work:

sum(i,ABS(x(i)-y(i)))
于 2013-05-19T15:01:46.007 回答
-1

ak - old values,
bk - new values

于 2013-05-19T14:35:31.883 回答