Question

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

Was it helpful?

Solution 2

ak - old values,
bk - new values

OTHER TIPS

This should work:

sum(i,ABS(x(i)-y(i)))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top