0

这是代码:

    s=5
    k=3
    mod= RobustModel(solver=GurobiSolver())
    @defUnc(mod,ξ[i=1:k,j=1:s])
    adaptive(mod,ext[1:k], policy=Affine, depends_on=ξ[1:k])
    @defVar(mod, obj)
    @setObjective(mod, Max, obj)

错误是:

    UndefVarError: Affine not defined.

为什么会出现这个问题?

4

1 回答 1

1

您似乎@adaptive.

以下是使用更新的 JuMP 宏语法的操作示例:

julia> using JuMP, JuMPeR, Gurobi

julia> s = 5
5

julia> k = 3
3

julia> mod = RobustModel(solver=GurobiSolver())
Feasibility problem with:
 * 0 linear constraints
 * 0 variables
Solver is Gurobi

julia> @uncertain(mod,ξ[i=1:k,j=1:s])
3x5 Array{JuMPeR.Uncertain,2}:
 ξ[1,1]  ξ[1,2]  ξ[1,3]  ξ[1,4]  ξ[1,5]
 ξ[2,1]  ξ[2,2]  ξ[2,3]  ξ[2,4]  ξ[2,5]
 ξ[3,1]  ξ[3,2]  ξ[3,3]  ξ[3,4]  ξ[3,5]

julia> @adaptive(mod,ext[1:k], policy=Affine, depends_on=ξ[1:k])
3-element Array{JuMPeR.Adaptive,1}:
 JuMPeR.Adaptive(Feasibility problem with:
 * 0 linear constraints
 * 0 variables
Solver is Gurobi,1)
 JuMPeR.Adaptive(Feasibility problem with:
 * 0 linear constraints
 * 0 variables
Solver is Gurobi,2)
 JuMPeR.Adaptive(Feasibility problem with:
 * 0 linear constraints
 * 0 variables
Solver is Gurobi,3)

julia> @variable(mod, obj)
obj

julia> @objective(mod, Max, obj)
obj
于 2016-08-30T16:15:20.067 回答