문제

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

도움이 되었습니까?

해결책 2

ak - old values,
bk - new values

다른 팁

This should work:

sum(i,ABS(x(i)-y(i)))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top