So i want to programme a Stackelberg model with the following complementary conditions:

It is a non-linear maximisation problem so I thought I should use ‘nlp’ to solve the model. Whilst the nlp programme runs without an error, it does not seem to have taken into account the complementary nature of the conditions. This produces a nonsensical result where mines in the US produce millions of tonnes of coal but do not sell anything! Is there a better solver to use other than ‘nlp’?

I know that this is a non-convex problem so any solver is not guaranteed to deliver a global optimum, but I think I will just re-run the programme with different starting values and then just assume that one of the solutions is a global optimum.

It’s important to consider exactly how you plan to represent each agent when choosing a model type. Terms like “Stackelberg” don’t do this fully. For example, some people often describe the case of two players - each characterized or represented by an optimization problem - as a Stackelberg game if there is a leader/follower relationship between the players. In such a case, you can best model this using EMP. There is a section in the docu about this and several examples in EMPLIB:

But it isn’t required that the follower agent be represented as an optimization model: the follower can be a VI as well (as in your case, where you have complementarity conditions describing the follower). This is mentioned specifically in the Bilevel Programming section linked to above. Examples include:

But you cannot solve your model as an NLP: what you describe doesn’t fit there and it’s no surprise that you get solutions that ignore the complementarity conditions when you attempt to solve as NLP.

Also, a suggestion to save you some time: start by formulating a somewhat trivial model for which you know the solution. Play with that formulation a bit and learn how things are supposed to behave: what the reformulation steps are, how to solve the follower agent in isolation by fixing the leader “solution”, etc. When this works, move on to a less trivial model - perhaps the one in question.

Hi Steve
Many thanks for your reply, it was very useful.
I used the suggestion to implement MPEC. I’m not sure if it would work as bilevel, as the model is quite large… I tried the Harker model and it wouldn’t work.

But the MPEC does work! Here is the code. April8.gms (19.9 KB)
For 2019, the solution does not change when I change the initial starting conditions. However, for the year 2020, the solution does change, unfortunately. This is not unexpected as the objective function is non-convex and thus solving the MPEC problem does not guarantee a globally optimal solution.

So I guess for 2019 I can accept the solution as a global optimal. And for 2020 I just need to find all the local solutions through experimentation and find which one is the highest.