Extract 1 from variables {-1, 0, 1}
Posted: Wed Oct 09, 2019 2:03 pm
Hi, this is my first question on Gams Forum.
I'm now modelling with gams, and having a trouble.
I have a variable name as A.
A(machine, time) only has value of -1, 0, 1 as its value.
Actually, 1 means 'turning on a machine', -1 means 'turning off machine' in my model.
I would like to extract only '1' and '-1' value from A.
I tried introducing new variables such as A_positive and A_negative.
Adding two more equations in my model.
A_positive(machine, time) = max(A(machine, time), 0);
A_negative(machine, time) = min(A(machine, time), 0);
But, it does not work with error message below.
"Endogenous function argument(s) not allowed in linear models"
Is there any other way that I can do this?
Thanks in advance.
I'm now modelling with gams, and having a trouble.
I have a variable name as A.
A(machine, time) only has value of -1, 0, 1 as its value.
Actually, 1 means 'turning on a machine', -1 means 'turning off machine' in my model.
I would like to extract only '1' and '-1' value from A.
I tried introducing new variables such as A_positive and A_negative.
Adding two more equations in my model.
A_positive(machine, time) = max(A(machine, time), 0);
A_negative(machine, time) = min(A(machine, time), 0);
But, it does not work with error message below.
"Endogenous function argument(s) not allowed in linear models"
Is there any other way that I can do this?
Thanks in advance.