Dear GAMS users,

I am trying to design constraints that can be used for reference tracking.

I want to put a penalty on a divergence of the line K with respect to the old_K.

I tried to formulate them as an absolute value.

I have formulated them as follow:

Keepitclose1(t)… K_down(t) =g= (- K(t) + old_K(t));

Keepitclose2(t)… K_up(t) =g= ( K(t) - old_K(t));

Keepitclose3(t)… K_down(t) =g= 0;

Keepitclose4(t)… K_up(t) =g= 0;

where K can be changed and old_K is the value that should be tracked.

which is for example when K = 5 and old_K = 6 would result in

Keepitclose1(t)… K_down(t) =g= (- 5+ 6); → -1

Keepitclose2(t)… K_up(t) =g= ( 5 - 6); → 1

Keepitclose3(t)… K_down(t) =g= 0;

Keepitclose4(t)… K_up(t) =g= 0;

thereby forcing the K(t) to go 6 to minimize cost

The costs are modeled as follow:

Cost_K_up… K_Cost_up =e= sum((t),K_up(t) *weight_K_up(t));

Cost_K_down… K_Cost_down =e= sum((t),K_down(t) *weight_K_down(t));

Cost_weighted… weighted =e= K_Cost_up + K_Cost_down;

weight_K_up(t) =1 and weight_K_down(t) = 1 are the weight of the penalty and weighted is added to the cost function.

Unfortunately, my results show very poor tracking or it becomes infeasible. The values of K_down/K_up in this example become 5 instead of the expected 0/1.

Do any of you see the problem in my formulation and/or does anybody know how to formulate it to penalize divergence of K_old?

Thanks for taking the time!