# Unclear error

**URL:** https://discourse.julialang.org/t/unclear-error/45356
**Category:** Optimization (Mathematical)
**Created:** [August 22, 2020, 8:46am UTC](https://discourse.julialang.org/t/unclear-error/45356 "2020-08-22T08:46:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mamo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mamo/32/25591_2.png) [@mamo](https://discourse.julialang.org/u/mamo)
#### Post date: [August 22, 2020, 8:46am UTC](https://discourse.julialang.org/t/unclear-error/45356/1 "2020-08-22T08:46:03Z")

</div>

Below, is example 6.2 from the book (Julia Programming for OR)  
‘’’ import Pkg  
Pkg.add(“DataFrames”)  
Pkg.add(“CSV”)  
Pkg.add(“JuMP”)  
Pkg.add(“MathOptInterface”)  
Pkg.add(“GLPK”)  
Pkg.add(“Clp”)  
Pkg.activate(@ **DIR** )  
Pkg.instantiate()  
Pkg.add(“JuMP”)  
Pkg.add(“DataStructures”)  
Pkg.add(“OrderedCollections”)  
using JuMP  
using MathOptInterface # Replaces MathProgBase  
using DataFrames, CSV

# shortcuts

const MOI = MathOptInterface  
const MOIU = MathOptInterface.Utilities  
using Clp  
using GLPK # Loading the GLPK module for using its solver  
using DelimitedFiles  
using OrderedCollections  
using DataStructures

data=DataFrame!(CSV.File(“julija1.csv”, header=false))

supply\_nodes=data[3:end,2]  
demand\_nodes=data[2, 3:end]  
demand\_nodes=collect(data[2,3:end]) #umesto 1x3 niza dobijamo 1x1 niz  
s = data[3:end, 1]  
d=data[1,3:end]  
d=collect(data[1,3:end])  
c=data[3:end, 3:end] #transportation const  
#converting to Dictionaries  
s\_dict=OrderedDict()  
for i in 1:length(supply\_nodes)  
s\_dict[supply\_nodes[i]]=s[i]  
end  
s\_dict=OrderedDict(zip(supply\_nodes,s)) #to keep the orders  
d\_dict=OrderedDict()  
for i in 1:length(demand\_nodes)  
d\_dict[demand\_nodes[i]]=d[i]  
end  
d\_dict=OrderedDict(zip(demand\_nodes,d)) #to keep the orders  
c\_dict=OrderedDict()  
for i in 1:length(supply\_nodes)  
for j in 1:length(demand\_nodes)  
c\_dict[supply\_nodes[i], demand\_nodes[j]]=c[i,j]  
end  
end  
tp = Model(GLPK.Optimizer)  
@variable(tp, x[supply\_nodes, demand\_nodes]\>=0)  
@objective(tp, Min, sum(c\_dict[i,j]\*x[i,j] for i in supply\_nodes, j in demand\_nodes))‘’’

Inputs:  
15 12 13  
Chicago Denver Erie  
15 Austin 10 7 9  
25 Buffalo 4 9 8

Everything was ok (and according to the book) until the @objective line, then this message has appeared:  
ERROR: LoadError: MethodError: no method matching \*(::String, ::VariableRef)  
Closest candidates are:  
\*(::Any, ::Any, ::Any, ::Any…) at operators.jl:529  
\*(::MutableArithmetics.Zero, ::Any) at C:\Users\mmill.julia\packages\MutableArithmetics\NuiNA\src\rewrite.jl:49  
\*(::SparseArrays.SparseMatrixCSC, ::MutableArithmetics.AbstractMutable) at C:\Users\mmill.julia\packages\MutableArithmetics\NuiNA\src\dispatch.jl:181  
Do you have any idea, what this occured?  
Best,  
marco

---

<div class="post-metadata">

### Author: ![tomerarnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomerarnon/32/3170_2.png) [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)
#### Post date: [August 22, 2020, 7:03pm UTC](https://discourse.julialang.org/t/unclear-error/45356/2 "2020-08-22T19:03:57Z")

</div>

Somewhere in your code you are multiplying a string by a variable from JuMP. The full error message also contains a stacktrace which you can look through the determine which line is the culprit (I’m fairly sure it’s because of what’s in `data`, but you’ll have to look into that yourself)

When you paste code in discourse, you should do so in “triple bacticks”. I.e.  
```  
your code  
```  
comes out looking like:

```julia
your code

```

which makes it much easier to read. It looks like you tried to do that with quotes, but the correct symbol is the “backtick” which (on an american keyboard at least) is to the left of the number keys (the same key as ~).

---

<div class="post-metadata">

### Author: ![mamo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mamo/32/25591_2.png) [@mamo](https://discourse.julialang.org/u/mamo)
#### Post date: [August 22, 2020, 7:55pm UTC](https://discourse.julialang.org/t/unclear-error/45356/3 "2020-08-22T19:55:42Z")

</div>

Thank you. The problem was with csv file.
