Hi, I’m new to Julia and I need some help.
I’m using Julia to solve this problem (not the full problem, the forum doesn’t let me because it exceed the number of users?):
import Pkg
Pkg.add("JuMP")
Pkg.add("CSV")
Pkg.add("Clp")
Pkg.add("GLPK")
Pkg.add("DataFrames")
Pkg.add("LinearAlgebra")
using JuMP, CSV, Clp, GLPK, DataFrames, LinearAlgebra
m = Model(with_optimizer(Clp.Optimizer))
#Variables: xij= cantidad de carros para bebés producidas por las plantas i= 1, 2, 3 que serán distribuidos mensualmente
# a los centros de distribucióna j= 1, 2, 3, 4
@variables(m, begin #Definimos las variables
x11>=0
x12>=0
x13>=0
x14>=0
x21>=0
x22>=0
x23>=0
x24>=0
x31>=0
x32>=0
x33>=0
x34>=0
end)
# restricciones de Oferta
@constraint(m, x11+x12+x13+x14==12)
@constraint(m, x21+x22+x23+x24==17)
@constraint(m, x31+x32+x33+x34==11)
# restricciones de Demanda
@constraint(m, x11+x21+x31== 10)
@constraint(m, x12+x22+x32== 10)
@constraint(m, x13+x23+x33== 10)
@constraint(m, x14+x24+x34== 10)
@objective(m, Min, 500*x11+750*x12+300*x13+700*x14+650*x21+800*x22+400*x23+600*x24+400*x31+700*x32+500*x33+550*x34)
print(m)
JuMP.optimize!(m)
obj_value=JuMP.objective_value(m)
x11=JuMP.value(x11)
x12=JuMP.value(x12)
x13=JuMP.value(x13)
x14=JuMP.value(x14)
x21=JuMP.value(x21)
x22=JuMP.value(x22)
x23=JuMP.value(x23)
x24=JuMP.value(x24)
x31=JuMP.value(x31)
x32=JuMP.value(x32)
x33=JuMP.value(x33)
x34=JuMP.value(x34)
println("Valor func objetivo_min=", obj_value)
println("x11 =", x11)
println("x12 =", x12)
println("x13 =", x13)
println("x14 =", x14)
println("x21 =", x21)
println("x22 =", x22)
println("x23 =", x23)
println("x24 =", x24)
println("x31 =", x31)
println("x32 =", x32)
println("x33 =", x33)
println("x34 =", x34)
And I got this error:
Unsatisfiable requirements detected for package LinQuadOptInterface [f8899e07]:
LinQuadOptInterface [f8899e07] log:
├─possible versions are: [0.1.0, 0.2.0, 0.3.0-0.3.1, 0.4.0-0.4.3, 0.5.0, 0.6.0] or uninstalled
├─restricted by julia compatibility requirements to versions: [0.3.0-0.3.1, 0.4.0-0.4.3, 0.5.0, 0.6.0] or uninstalled
├─restricted by compatibility requirements with Clp [e2554f3b] to versions: [0.4.0-0.4.3, 0.6.0]
│ └─Clp [e2554f3b] log:
│ ├─possible versions are: [0.0.5-0.0.10, 0.1.0-0.1.1, 0.2.0-0.2.2, 0.3.0-0.3.1, 0.4.0, 0.5.0-0.5.1, 0.6.0-0.6.2] or uninstalled
│ ├─restricted to versions * by an explicit requirement, leaving only versions [0.0.5-0.0.10, 0.1.0-0.1.1, 0.2.0-0.2.2, 0.3.0-0.3.1, 0.4.0, 0.5.0-0.5.1, 0.6.0-0.6.2]
│ └─restricted by julia compatibility requirements to versions: [0.5.0-0.5.1, 0.6.0-0.6.2] or uninstalled, leaving only versions: [0.5.0-0.5.1, 0.6.0-0.6.2]
└─restricted by compatibility requirements with MathOptInterface [b8f27783] to versions: uninstalled — no versions left
└─MathOptInterface [b8f27783] log:
├─possible versions are: [0.1.0, 0.2.0, 0.3.0, 0.4.0-0.4.1, 0.5.0-0.5.1, 0.6.0-0.6.4, 0.7.0, 0.8.0-0.8.4, 0.9.0-0.9.1] or uninstalled
├─restricted by julia compatibility requirements to versions: [0.5.0-0.5.1, 0.6.0-0.6.4, 0.7.0, 0.8.0-0.8.4, 0.9.0-0.9.1] or uninstalled
└─restricted by compatibility requirements with JuMP [4076af6c] to versions: 0.9.1
└─JuMP [4076af6c] log:
├─possible versions are: [0.1.1-0.1.2, 0.2.0, 0.3.0-0.3.2, 0.4.0-0.4.1, 0.5.0-0.5.8, 0.6.0-0.6.3, 0.7.0-0.7.4, 0.8.0, 0.9.0-0.9.3, 0.10.0-0.10.3, 0.11.0-0.11.3, 0.12.0-0.12.2, 0.13.0-0.13.2, 0.14.0-0.14.2, 0.15.0-0.15.1, 0.16.0-0.16.2, 0.17.0-0.17.1, 0.18.0-0.18.6, 0.19.0-0.19.2, 0.20.0] or uninstalled
└─restricted to versions 0.20.0 by an explicit requirement, leaving only versions 0.20.0
Stacktrace:
[1] #propagate_constraints!#61(::Bool, ::Function, ::Pkg.GraphType.Graph, ::Set{Int64}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/GraphType.jl:1005
[2] propagate_constraints! at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/GraphType.jl:946 [inlined]
[3] #simplify_graph!#121(::Bool, ::Function, ::Pkg.GraphType.Graph, ::Set{Int64}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/GraphType.jl:1460
[4] simplify_graph! at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/GraphType.jl:1460 [inlined] (repeats 2 times)
[5] resolve_versions!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Nothing) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:371
[6] resolve_versions! at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:315 [inlined]
[7] #add_or_develop#63(::Array{Base.UUID,1}, ::Symbol, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:1171
[8] #add_or_develop at ./none:0 [inlined]
[9] #add_or_develop#15(::Symbol, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:54
[10] #add_or_develop at ./none:0 [inlined]
[11] #add_or_develop#14 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:31 [inlined]
[12] #add_or_develop at ./none:0 [inlined]
[13] #add_or_develop#13 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:29 [inlined]
[14] #add_or_develop at ./none:0 [inlined]
[15] #add_or_develop#12(::Base.Iterators.Pairs{Symbol,Symbol,Tuple{Symbol},NamedTuple{(:mode,),Tuple{Symbol}}}, ::Function, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:28
[16] #add_or_develop at ./none:0 [inlined]
[17] #add#20 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:59 [inlined]
[18] add(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:59
[19] top-level scope at In[1]:4
It is a problem with the package version? I tried using the try jupyter with julia from the jupyter page and installed both julia and anaconda using this guide How to Add Julia to Jupyter Notebook - Data to Fish, but both didn’t work.
To be honest I have no idea what exactly I have to do, if somebody can help me. Thanks