WARNING: Module JuMP not defined on process 2
fatal error on 2: ERROR: UndefVarError: JuMP not defined
I have tried: @everywhere using JuMP but I still get the error. I thought it may be a problem with JuliaStudio so I have also tried running it from the Julia command line but am still getting the same error.
Thanks in advance for any guidance,
Kirsten
using JuMP
using Clp
using Cbc
function main()
model = Model(solver=ClpSolver())
@defVar(model, a[1:10] )
@defVar(model, e[1:10] >= 0)
@defConstrRef constraints[1:10]
constraints = [@addConstraint(model, a[i] + e[i] >= 1) for i=1:10]
@sync @parallel for j = 1:10
chgConstrRHS(constraints[j], -999)
solve(model)
end
endDid you try the @everywhere macro?
@everywhere include("foo.jl")
--
You received this message because you are subscribed to the Google Groups "julia-opt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to julia-opt+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@everywhere using JuMP, NLopt
function main(max :: Int)
argin = [i for i=1:max]
result = Array(Float64,max,2)
for i =1:max
result[i,:] = testjump(argin[i])
end
presult = pmap( testjump, argin )
return result,presult
end
function testjump(seed :: Int)
N = 20
srand(seed)
Z=[ones(N) randn(N)]
b=[2; 3]
y=Z*b+rand(N)
m = Model( solver=NLoptSolver(algorithm=:LD_SLSQP))
@variable(m, x[ i = 1 : size(Z)[2] ] )
@NLobjective(m, Min, sum{(y[i]- sum{ Z[i,j]*x[j], j=1:size(Z)[2]})^2, i=1:size(Z)[1]})
print(m)
solve(m)
println("beta= ",getvalue(x))
return getvalue(x)
endjulia> main(3)
Min (nonlinear expression)
Subject to
x[i] free ∀ i ∈ {1,2}
beta= [2.4562065996319573,2.9402595697321345]
Min (nonlinear expression)
Subject to
x[i] free ∀ i ∈ {1,2}
beta= [2.387999953872386,3.069169773706371]
Min (nonlinear expression)
Subject to
x[i] free ∀ i ∈ {1,2}
beta= [2.5433281110335435,3.059284556879825]
(
3x2 Array{Float64,2}:
2.45621 2.94026
2.388 3.06917
2.54333 3.05928,
Any[RemoteException(2,CapturedException(ErrorException("function testjump not defined on process 2"),Any[(:error,symbol("/Applications/Julia-0.4.6.app/Contents/Resources/julia/lib/julia/sys.dylib"),-1,symbol(""),-1,1),(:anonymous,symbol("serialize.jl"),526,symbol(""),-1,1),(:anonymous,symbol("multi.jl"),923,symbol(""),-1,1),(:run_work_thunk,symbol("multi.jl"),661,symbol(""),-1,1),(:anonymous,symbol("multi.jl"),923,symbol("task.jl"),63,1)]))])
anyone knows why?
Thanks a lot,
Alex