I am using AMPL for the optimization of my model, and just have started with that project.
I have two variables, say A and B that I utilize in my objective function:
A[d,t]*costA-B[d,t]*costB
Later on I have the following constraint:
G[d,t]-U[d,t]-R[d,t]=A[d,t]
Here I realized that I can use just A, but the problem is, depending on whether or not this variable will be positive or negative I should use costA or costB.
My question is, can I redefine A[d,t] as B[d,t] if A[d,t] is less than 0? And if I can, how can I do it? Or is there any other way?
I think what you are after is something like (in some math-like notation):
min sum((d,t), APlus[d,t]*CostA + AMin[d,t]*CostB)
s.t. A[d,t] = APlus[d,t]-AMin[d,t]
positive variables APlus,AMin
This is called "variable splitting".