## Modeling KKT

Problems with syntax of GAMS
bzb
User
Posts: 1
Joined: 4 months ago

### Modeling KKT

Hi everyone,

I am trying to learn how to model the KKT conditions of a simple economic dispatch problem. I have already run through my handwritten model and its KKT conditions, and the instructor confirmed they were correct. I am having issues with running my GAMS model, however, and this simply stems from lack of experience using it (hence why I am trying to learn).

The instructor I am working with is out of town and away from his email for around a week, but I still want to make some progress in what we're working on. Right now, as I said, I'm doing basic examples to get more familiar with the concepts and the GAMS code. I will include my code below. I wonder if my issue is how I am choosing to solve it; I did not know whether solving with nlp would be relevant since the complementary slackness conditions are nonlinear.

My actual model is below:

https://pastebin.com/30GbLhib

The set n represents the machines available to meet demand (which didn't factor into KKT conditions). Set t represents the hours over which the machines will operate (so machine n will operate from hours t = 1 to t = T).

C(n) is both the cost to operate machine n (in any hour) and the generalized gradient form of the objective function: (sum(t, sum(n, c(n)*x(n,t))).

Q(n) is the production capacity of generator n. It shows up in the generalized capacity constraint x(n,t) - Q(n) <= 0.

My instructor said that since I've declared all variables as strictly positive, I do not need the non-negativity constraints for x(n,t) and thus I do not need as many KKT conditions. However I wonder if setting mu(x,t) as a positive variable is causing issues. Does declaring a positive variable remove the chance it equals zero?

Any feedback would be appreciated. I am also trying to get used to using GAMS ability to manipulate similar algebraic structure with the KKT equation and the "sl" equations (which are the complementary slackness conditions).