0

This is the code:

    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)

The error is:

    UndefVarError: Affine not defined.

Why does this problem happen?

Fengyang Wang
  • 11,901
  • 2
  • 38
  • 67

1 Answers1

1

You seem to be missing an @ in front of adaptive.

Here is an example of your operations using more recent JuMP macro syntax:

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