# The objective function \`Val{false}()\` is not supported by JuMP

**URL:** <https://discourse.julialang.org/t/the-objective-function-val-false-is-not-supported-by-jump/30296>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [October 25, 2019, 10:40am UTC](https://discourse.julialang.org/t/the-objective-function-val-false-is-not-supported-by-jump/30296 "2019-10-25T10:40:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NextMyth](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@NextMyth](https://discourse.julialang.org/u/NextMyth)\
**Post date:** [October 25, 2019, 10:40am UTC](https://discourse.julialang.org/t/the-objective-function-val-false-is-not-supported-by-jump/30296/1 "2019-10-25T10:40:44Z")

</div>

Hi, I am trying to build a NHL DFS lineup optimizer using code found at [https://github.com/dscotthunter/Fantasy-Hockey-IP-Code/blob/master/code\_for\_Github.jl](https://github.com/dscotthunter/Fantasy-Hockey-IP-Code/blob/master/code_for_Github.jl) which needs updated for the current version of JuMP. I’m very new to Julia and JuMP but I’ve had some success working on it until I got stuck at the following error:

```julia
 [1] set_objective(::Model, ::MathOptInterface.OptimizationSense, ::Val{false}) at /home/greg/.julia/packages/JuMP/iGamg/src/objective.jl:101
 [2] one_lineup_Type_4(::DataFrame, ::DataFrame, ::Array{Int64,2}, ::Int64, ::Int64, ::Int64, ::Array{Int64,1}, ::Array{Int64,1}, ::Array{Int64,1}, ::Int64, ::LinearAlgebra.Adjoint{Int64,Array{Int64,1}}, ::Array{Any,1}, ::Array{Int64,2}, ::Int64, ::Array{Int64,1}) at /home/greg/.julia/packages/JuMP/iGamg/src/macros.jl:979
 [3] create_lineups(::Int64, ::Int64, ::String, ::String, ::typeof(one_lineup_Type_4), ::String) at /data/Projects/Sports/NHL/lineupoptimizer.jl:265
 [4] top-level scope at /data/Projects/Sports/NHL/lineupoptimizer.jl:332
 [5] include at ./boot.jl:328 [inlined]
 [6] include_relative(::Module, ::String) at ./loading.jl:1094
 [7] include(::Module, ::String) at ./Base.jl:31
 [8] include(::String) at ./client.jl:431
 [9] top-level scope at REPL[1]:1
in expression starting at /data/Projects/Sports/NHL/lineupoptimizer.jl:332

```

The objective function I’m using is:

```julia
@objective(m, Max, sum(skaters[i,:Projection]*skaters_lineup[i] for i=1:num_skaters) + sum(goalies[i,:Projection]*goalies_lineup[i] for i=1:num_goalies))

```

The full code is at [https://github.com/TheNextMyth/Fantasy-Hockey-IP-Code/blob/master/lineupoptimizer.jl](https://github.com/TheNextMyth/Fantasy-Hockey-IP-Code/blob/master/lineupoptimizer.jl) and also has the csv files I was using for testing.

I believe there is something wrong with the objective function formula I am passing in but am not sure. Any help is appreciated. Please let me know what other information I need to include or if I made some other posting mistake. Thank you.

---

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [October 25, 2019, 12:16pm UTC](https://discourse.julialang.org/t/the-objective-function-val-false-is-not-supported-by-jump/30296/2 "2019-10-25T12:16:35Z")

</div>

Aren’t `num_skaters` and `num_goalies` equal to zero ?  
I can reproduce it with

```julia
julia> using JuMP

julia> model = Model()
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: NO_OPTIMIZER
Solver name: No optimizer attached.

julia> @objective(model, Max, sum(1 for i in 1:0))
ERROR: The objective function `Val{false}()` is not supported by JuMP.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] set_objective(::Model, ::MathOptInterface.OptimizationSense, ::Val{false}) at /home/blegat/.julia/packages/JuMP/iGamg/src/objective.jl:101
 [3] top-level scope at /home/blegat/.julia/packages/JuMP/iGamg/src/macros.jl:979

```

I just reported the unhelpful error message in [https://github.com/JuliaOpt/JuMP.jl/issues/2087](https://github.com/JuliaOpt/JuMP.jl/issues/2087)

---

<div class="post-metadata">

**Author:** ![NextMyth](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@NextMyth](https://discourse.julialang.org/u/NextMyth)\
**Post date:** [October 25, 2019, 10:03pm UTC](https://discourse.julialang.org/t/the-objective-function-val-false-is-not-supported-by-jump/30296/3 "2019-10-25T22:03:39Z")

</div>

Here is where I thought I was assigning num\_skaters and num\_goalies

```julia
    # Load information for skaters table
    skaters = CSV.read(path_skaters)

    # Load information for goalies table
    goalies = CSV.read(path_goalies)

    # Number of skaters
    num_skaters = size(skaters)[1]

    # Number of goalies
    num_goalies = size(goalies)[1]

```
