我是朱莉娅的新手。尝试使用 Julia、JuMP 和 PATHSolver 将玩具经济均衡模型实现为 MCP。
该问题假设两个区域交易一种商品。每个地区都有线性需求和固定的外生供给A。问题是找到市场出清均衡价格P,并受到贸易上限和下限的约束。这是代码:
using JuMP, PATHSolver
β_0 = [10.0, 5.0]
β_1 = [-0.5, -0.25]
t_min = 0.0
t_max = 2.0
A = [1, 1]
model = Model(PATHSolver.Optimizer)
@variables(model, begin
t_min <= trade <= t_max
p1 >= 0
p2 >= 0
end)
@constraints(model, begin
p2 - p1 ⟂ trade
β_0[1] + β_1[1] * p1 - A[1] + trade ⟂ p1
β_0[2] + β_1[2] * p2 - A[2] - trade ⟂ p2
end)
optimize!(model)
solution_summary(model; verbose=true)
这是输出:
* Solver : Path 5.0.03
* Status
Result count : 1
Termination status : LOCALLY_SOLVED
Message from the solver:
"The problem was solved"
* Candidate solution (result #1)
Primal status : FEASIBLE_POINT
Dual status : NO_SOLUTION
Objective value : 0.00000e+00
Primal solution :
p1 : 0.00000e+00
p2 : 0.00000e+00
trade : 0.00000e+00
* Work counters
Solve time (sec) : 2.99100e-03
有什么特别的问题吗?看起来该解决方案是有效的均衡。
您可能想设置不同的起始解决方案:
@variables(model, begin
t_min <= trade <= t_max, (start = 1)
p1 >= 0, (start = 1)
p2 >= 0, (start = 1)
end)