julia-mpsge / MPSGE_MP.jl

MIT License
1 stars 0 forks source link

Default Numeraire is calculated wrong for counterfactuals #20

Closed mitchphillipson closed 2 months ago

mitchphillipson commented 4 months ago

The GAMS default numeraire is set per solve and gets an updated value depending on parameters. Currently our implementation does not track this.

mitchphillipson commented 4 months ago

Before each solve we need to do a few things,

  1. Update the starting value of each consumer, $H$, with the value $$\sum{e\in\text{ endowments}} \text{quantity}(e) + \sum{t\in\text{ tax | agent(t) = H}} |C|\cdot t\cdot Q$$ where the endowments come from the Demand associated with $H$ and $|C|$ is the value of $C$ after the most recent solve.
  2. If no values are fixed, the numeraire is then the consumer with the largest starting value and is fixed at this value. This consumer is stored so it can be unfixed prior to the next solve.

The issue is getting the value of $|C|$. Any operations on the JuMP model make the model dirty so that value(C) raises an error.

mitchphillipson commented 2 months ago

I think the best solution here is going to be to store the values within MPSGEVariables. This has the added benefit of us being able to be precise in what the values become. For example, before the model has been solved we expect the value to be the starting value, if we fix the variable we can update the value and so on.

mitchphillipson commented 2 months ago

Before each solve we need to do a few things,

  1. Update the starting value of each consumer, H, with the value ∑e∈ endowmentsquantity(e)+∑t∈ tax | agent(t) = H|C|⋅t⋅Q where the endowments come from the Demand associated with H and |C| is the value of C after the most recent solve.
  2. If no values are fixed, the numeraire is then the consumer with the largest starting value and is fixed at this value. This consumer is stored so it can be unfixed prior to the next solve.

The issue is getting the value of |C|. Any operations on the JuMP model make the model dirty so that value(C) raises an error.

Another issue is that quantity(e) might be an expression with auxiliary variables in it. Which means value won't work, even if the MPSGEVariable knows it's value.