Dear community. I’m new to Julia and trying to code a Computable General Equilibrium Model. I have a question about Complementarity that I still can’t fully understand from going through various sources on the web.
I know I can have only one complementarity constraint per equation, right? But what I’m not totally sure of is if I have to specify all equations in @mapping setting them equal to zero, which would force me to rethink all equations such that I make sure they are all set equal to 0.
Example:
m=MCPModel()
… @mapping(m, equation1, x^a - bq^2 + 5c …) equation is just an example @complementarity(m, equation1, x)
now does equation1 (featuring x) here have to be set equal to zero ALWAYS or doesn’t it need to be? What alternatives do I have? Sorry if the question is stupid.
Thank you very much.
Best!
Hi @odow. Thank you very much. As I’m not so familiar with coding per se (only used R and a bit MATLAB for econometrics) I looked for some examples of General Equilibrium in Julia and the simplest approach I found was using complementarity, not knowing if there was/is something better.
So you recommend to just drop the complementarity package? I will start br trying to readapt the examples I have to JUMP only (as in the documentation you shared) and see if I get the idea. Since I see you’re the core contributor to JUMP (congratulations!), do you happen to know of anyone who works on computable general equilibrium using JUMP? Thank you very much.
Best!
Yes, check out our package. We’ve built a Julia update of the MPSGE package (originally built in GAMS) so it’s pre-structured for CGE, MCP by default. Documentation is still a bit sparse, but the examples and test code should give a good idea, and I’d be happy to talk more.
Thank you very much @EliLazarus and @odow! I will definitely look into these resources. Maybe two quick questions that I’m still not absolutely certain about.
In order to be able to apply MCP, do I have to express ALL equations in the model setting them equal to 0?
Does the complementarity condition for each equation have to feature a variable that is present in this equation or can any equation have a complementarity variable that is not necessarily present in this equation?
No, I don’t, because I haven’t yet tried to write my model as an MCP problem, but in the model I saw written with the complementarity package all equations are expressed such that, in equilibrium, there value would be 0. This is where my question comes from. In this small model I saw, it made sense, but I think in my larger model some equations might not be naturally 0 in equilibrium. I will come back to you after I try to write my own model if I’m still unsure about this.