Solving dynamic complementarity problem using Optim.jl or Complementarity.jl

You’re looking for something like

using JuMP
import PATH

function geological_constraints_MCP()
    A = 50.0
    B = 0.1
    δ = 0.05
    R₀ = 0.5
    T = 10
    model = Model(PATH.Optimizer)
    @variables(model, begin
        q[1:T] >= 0
        λ[1:T] >= 0
        R[1:T] >= 0
    end)
    @constraints(model, begin
        [t = 1:T], -(A - B * q[t] - λ[t])                     ⟂ q[t] 
        [t = 1:T], -((t < T ? λ[t + 1] : A) - (1 + δ) * λ[t]) ⟂ R[t]
        [t = 1:T], -(R[t] + q[t] - (t > 1 ? R[t - 1] :  R₀))  ⟂ λ[t]
    end)
    optimize!(model)
    @show termination_status(model)
    @show primal_status(model)
    @show value.(q)
    @show value.(λ)
    @show value.(R)
    return model
end

geological_constraints_MCP()

I don’t fully understand your model. For example, @complementarity(gxt,FOCλ,R) seemed like it should be @complementarity(gxt,FOCλ,λ) based on your original post?

Nevertheless, hope the syntax helps.

1 Like