# WARNING: isnan(x::AbstractArray{T}) where T \<: Number is deprecated, use isnan.(x) instead

**URL:** https://discourse.julialang.org/t/warning-isnan-x-abstractarray-t-where-t-number-is-deprecated-use-isnan-x-instead/13537
**Category:** New to Julia
**Created:** [August 15, 2018, 11:52pm UTC](https://discourse.julialang.org/t/warning-isnan-x-abstractarray-t-where-t-number-is-deprecated-use-isnan-x-instead/13537 "2018-08-15T23:52:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![marcelord12](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@marcelord12](https://discourse.julialang.org/u/marcelord12)
#### Post date: [August 15, 2018, 11:52pm UTC](https://discourse.julialang.org/t/warning-isnan-x-abstractarray-t-where-t-number-is-deprecated-use-isnan-x-instead/13537/1 "2018-08-15T23:52:49Z")

</div>

Hi guys  
I’m trying again to run a script file when suddenly I got this warning message. I couldn’t debug these warning and I don’t know what to do. Can somebody help to fix? I’m working on Julia 0.6.4 in Atom 1.29. My code is depicted bellow:

script file: sample.jl

```julia

# MDP problem description

# Get transition matrices
Tensor = Dict()
f = open(joinpath(@ __DIR__ , "Tensor1.txt"), "r+")
Tensor["1"] = readdlm(f)
g=f = open(joinpath(@ __DIR__ , "Tensor2.txt"), "r+")
Tensor["2"] = readdlm(g)

# Get reward function
Rewards = Dict()
h = open(joinpath(@ __DIR__ , "Rewards1.txt"), "r+")
Rewards["1"] = readdlm(h)
i = open(joinpath(@ __DIR__ , "Rewards1.txt"), "r+")
Rewards["2"] = readdlm(i)

# State space description
States = Dict()
States["#states"] = size(Tensor["1"],1)
States["FeatSize"] = [2,162]

Actions = Dict()
Actions["#actions"] = 2

Constraints = Dict()
Constraints["#constraints"] = 1
Constraints["States"] = [52]

# Initial condition
init = 1
λ = 0.7

VXpolicy = CMDP(States,Actions,
                Tensor,Rewards,
                λ,init,zeros(3),Constraints)

(Values,Policy) = SolveCMDP(VXpolicy);

TotalStates = States["#states"]

MC = zeros(TotalStates,TotalStates)

for i = 1:TotalStates
   ind = Policy[i]
   MC[i,:] = Tensor["$(ind)"][i,:]
end

```

script file: MDP\_LP.jl

```nohighlight
using SCS

type CMDP

    States::Dict{Any,Any} # Dictionary describing states
    Actions::Dict{Any,Any} # Dictionary describing actions

    Tensor::Dict{Any,Any} # Dictionary for Tensor
    Rewards::Dict{Any,Any} # Dictionary for Rewards

    λ::Float64 # Discount factor

    InitState::Int # Initial state
    InitStateArray::Array{Int,1} # Initial features

    Constraints::Dict{Any,Any} # Array of state constraints (index of state)

end

function SolveCMDP(problem::CMDP)

    Ns = problem.States["#states"]
    Na = problem.Actions["#actions"]

    StateFeat = problem.States["FeatSize"]

    Tensor = problem.Tensor
    Rewards = problem.Rewards

    init = problem.InitState
    Findex = problem.InitStateArray

    NCon = problem.Constraints["#constraints"]
    StateCon = problem.Constraints["States"]

    λ = problem.λ

    if(init == 0)
        init = sub2ind(StateFeat[end:-1:1],Findex[end:-1:1])
    end

    # Note that the variables are the occupational measures
    X = Variable(Ns*Na)

    # Objective
    C = zeros(Ns*Na,1)
    for i=1:Na
        C[(i-1)*Ns+1:i*Ns,:] = Rewards["$(i)"]
    end

    # Equality constraint
    I = zeros(Ns,Ns*Na)
    T = zeros(Ns,Ns*Na)
    for i=1:Na
        I[:,(i-1)*Ns+1:i*Ns] = eye(Ns)
        T[:,(i-1)*Ns+1:i*Ns] = transpose(Tensor["$(i)"])
    end

    Aeq = I - T
    Beq = zeros(Ns,1)
    Beq[init] = 1

    if NCon > 0
        for i=1:NCon
            AeqC = zeros(Na,Ns*Na)
            BeqC = zeros(Na,1)

            for j=1:Na
                # State constraint index
                state_con_id = (j-1)*Ns + StateCon[i]
                AeqC[j,state_con_id] = 1;

                Aeq = vcat(Aeq,AeqC)
                Beq = vcat(Beq,BeqC)
            end

        end
    end

    Aineq = eye(2*Ns)
    Bineq = zeros(Ns*Na,1)

    Constraint = [Aineq*X >= Bineq;Aeq*X == Beq]
    p = maximize(C'*X,Constraint)

    solve!(p, SCSSolver(verbose=0,max_iters=50000))

    Values = -Constraint[2].dual

    OccMeas = zeros(Ns,Na)
    ActDist = zeros(Ns,Na)
    OptAct = zeros(Int,Ns)

    sol = X.value

    for i=1:Na
        OccMeas[:,i] = sol[(i-1)*Ns+1:i*Ns]
    end

    for i=1:Ns
        normalizer = sum(OccMeas[i,:])
        for j=1:Na
            ActDist[i,j] = OccMeas[i,j]/normalizer
        end
        (maxval,index) = findmax(ActDist[i,:])
        OptAct[i] = index
    end

    return Values,OptAct end

```

WARNING: isnan(x::AbstractArray{T}) where T \<: Number is deprecated, use isnan.(x) instead.  
Stacktrace:  
[1] depwarn(::String, ::Symbol) at ./deprecated.jl:70  
[2] isnan(::Array{Float64,1}) at ./deprecated.jl:57  
[3] populate\_solution!(::SCS.SCSMathProgModel, ::Convex.Problem, ::Dict{UInt64,Tuple{Int64,Int64}}, ::Array{Convex.ConicConstr,1}) at /Users/marcelord12/.julia/v0.6/Convex/src/solution.jl:118  
[4] #solve!#25(::Bool, ::Bool, ::Bool, ::Function, ::Convex.Problem) at /Users/marcelord12/.julia/v0.6/Convex/src/solution.jl:38  
[5] #solve!#24(::Array{Any,1}, ::Function, ::Convex.Problem, ::SCS.SCSSolver) at /Users/marcelord12/.julia/v0.6/Convex/src/solution.jl:13  
[6] SolveCMDP(::CMDP) at /Users/marcelord12/Documents/phd2018/mppo/thesis/MDP/LP/MDP\_LP.jl:87  
[7] include\_string(::String, ::String) at ./loading.jl:522  
[8] include\_string(::String, ::String, ::Int64) at /Users/marcelord12/.julia/v0.6/CodeTools/src/eval.jl:30  
[9] include\_string(::Module, ::String, ::String, ::Int64, ::Vararg{Int64,N} where N) at /Users/marcelord12/.julia/v0.6/CodeTools/src/eval.jl:34  
[10] (::Atom.##102#107{String,Int64,String})() at /Users/marcelord12/.julia/v0.6/Atom/src/eval.jl:82  
[11] withpath(::Atom.##102#107{String,Int64,String}, ::String) at /Users/marcelord12/.julia/v0.6/CodeTools/src/utils.jl:30  
[12] withpath(::Function, ::String) at /Users/marcelord12/.julia/v0.6/Atom/src/eval.jl:38  
[13] hideprompt(::Atom.##101#106{String,Int64,String}) at /Users/marcelord12/.julia/v0.6/Atom/src/repl.jl:67  
[14] macro expansion at /Users/marcelord12/.julia/v0.6/Atom/src/eval.jl:80 [inlined]  
[15] (::Atom.##100#105{Dict{String,Any}})() at ./task.jl:80  
while loading /Users/marcelord12/Documents/phd2018/mppo/thesis/MDP/LP/Sample.jl, in expression starting on line 39  
WARNING: Problem status UnknownError; solution may be inaccurate.

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [August 15, 2018, 11:54pm UTC](https://discourse.julialang.org/t/warning-isnan-x-abstractarray-t-where-t-number-is-deprecated-use-isnan-x-instead/13537/2 "2018-08-15T23:54:35Z")

</div>

The deprecation warnings comes from inside `Convex.jl` so it seems that package needs to get updated.
