jump-dev / Convex.jl

A Julia package for disciplined convex programming
https://jump.dev/Convex.jl/stable/
Other
567 stars 121 forks source link

JuMP README example stopped working #691

Closed blegat closed 4 months ago

blegat commented 4 months ago

Clarabel seems to receive an empty model

ericphanson commented 4 months ago

hm, works for me:

julia> using JuMP, Convex, Clarabel
 │ Packages [JuMP, Convex, Clarabel] not found, but packages named [JuMP, Convex, Clarabel] are available from a
 │ registry.
 │ Install packages?
 │   (jl_dIDHI0) pkg> add JuMP Convex Clarabel
 └ (y/n/o) [y]:
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
   Installed Clarabel ─ v0.8.1
   Installed JuMP ───── v1.22.1
    Updating `/private/var/folders/jb/plyyfc_d2bz195_0rc0n_zcw0000gp/T/jl_dIDHI0/Project.toml`
  [61c947e1] + Clarabel v0.8.1
  [f65535da] + Convex v0.16.0
  [4076af6c] + JuMP v1.22.1
    Updating `/private/var/folders/jb/plyyfc_d2bz195_0rc0n_zcw0000gp/T/jl_dIDHI0/Manifest.toml`
  [14f7f29c] + AMD v0.5.3
  [1520ce14] + AbstractTrees v0.4.5
  [6e4b80f9] + BenchmarkTools v1.5.0
  [61c947e1] + Clarabel v0.8.1
  [523fee87] + CodecBzip2 v0.8.2
  [944b1d66] + CodecZlib v0.7.4
  [bbf7d656] + CommonSubexpressions v0.3.0
  [34da2185] + Compat v4.15.0
  [f65535da] + Convex v0.16.0
  [864edb3b] + DataStructures v0.18.20
  [163ba53b] + DiffResults v1.1.0
  [b552c78f] + DiffRules v1.15.1
  [ffbed154] + DocStringExtensions v0.9.3
  [e2ba6199] + ExprTools v0.1.10
  [f6369f11] + ForwardDiff v0.10.36
  [14197337] + GenericLinearAlgebra v0.3.11
  [34c5aeac] + HSL v0.4.3
  [92d709cd] + IrrationalConstants v0.2.2
  [692b3bcd] + JLLWrappers v1.5.0
  [682c06a0] + JSON v0.21.4
  [4076af6c] + JuMP v1.22.1
  [40e66cde] + LDLFactorizations v0.10.1
  [2ab3a3ac] + LogExpFunctions v0.3.27
  [1914dd2f] + MacroTools v0.5.13
  [b8f27783] + MathOptInterface v1.30.0
  [d8a4904e] + MutableArithmetics v1.4.4
  [77ba4419] + NaNMath v1.0.2
  [bac558e1] + OrderedCollections v1.6.3
  [46dd5b70] + Pardiso v0.5.7
  [69de0a69] + Parsers v2.8.1
  [aea7be01] + PrecompileTools v1.2.1
  [21216c6a] + Preferences v1.4.3
  [bfc457fd] + QDLDL v0.4.1
  [ae029012] + Requires v1.3.0
  [66db9d55] + SnoopPrecompile v1.0.3
  [276daf66] + SpecialFunctions v2.4.0
  [90137ffa] + StaticArrays v1.9.4
  [1e83bf80] + StaticArraysCore v1.4.2
  [a759f4b9] + TimerOutputs v0.5.24
  [3bb67fe8] + TranscodingStreams v0.10.8
  [6e34b625] + Bzip2_jll v1.0.8+1
  [017b0a0e] + HSL_jll v2.0.0+0
  [1d5cc7b8] + IntelOpenMP_jll v2024.1.0+0
  [856f044c] + MKL_jll v2024.1.0+0
⌅ [656ef2d0] + OpenBLAS32_jll v0.3.24+0
  [efe28fd5] + OpenSpecFun_jll v0.5.5+0
  [1317d2d5] + oneTBB_jll v2021.12.0+0
  [0dad84c5] + ArgTools v1.1.1
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [f43a241f] + Downloads v1.6.0
  [7b1f6079] + FileWatching
  [b77e0a4c] + InteractiveUtils
  [4af54fe1] + LazyArtifacts
  [b27032c2] + LibCURL v0.6.4
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [ca575930] + NetworkOptions v1.2.0
  [44cfe95a] + Pkg v1.10.0
  [de0858da] + Printf
  [9abbd945] + Profile
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA v0.7.0
  [9e88b42a] + Serialization
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays v1.10.0
  [10745b16] + Statistics v1.10.0
  [4607b0f0] + SuiteSparse
  [fa267f1f] + TOML v1.0.3
  [a4e569a6] + Tar v1.10.0
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll v1.1.1+0
  [deac9b47] + LibCURL_jll v8.4.0+0
  [e37daf67] + LibGit2_jll v1.6.4+0
  [29816b5a] + LibSSH2_jll v1.11.0+1
  [c8ffd9c3] + MbedTLS_jll v2.28.2+1
  [14a3606d] + MozillaCACerts_jll v2023.1.10
  [4536629a] + OpenBLAS_jll v0.3.23+4
  [05823500] + OpenLibm_jll v0.8.1+2
  [bea87d4a] + SuiteSparse_jll v7.2.1+1
  [83775a58] + Zlib_jll v1.2.13+1
  [8e850b90] + libblastrampoline_jll v5.8.0+1
  [8e850ede] + nghttp2_jll v1.52.0+1
  [3f19e933] + p7zip_jll v17.4.0+2
        Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
Precompiling project...
  5 dependencies successfully precompiled in 38 seconds. 56 already precompiled.

julia> model = Model(() -> Convex.Optimizer(Clarabel.Optimizer));

julia> set_silent(model)

julia> @variable(model, x >= 1);

julia> @variable(model, t);

julia> @constraint(model, t >= exp(x))
t - exp(x) ≥ 0

julia> @objective(model, Min, t);

julia> optimize!(model)

julia> value(x), value(t)
(0.9999999965102941, 2.7182817931858847)

I also tried with Clarabel v0.7 and it worked there too for me.

odow commented 4 months ago

Works for me too:

julia> using JuMP, Convex, Clarabel

julia> model = Model(() -> Convex.Optimizer(Clarabel.Optimizer));

julia> set_silent(model)

julia> @variable(model, x >= 1);

julia> @variable(model, t);

julia> @constraint(model, t >= exp(x))
t - exp(x) ≥ 0

julia> @objective(model, Min, t);

julia> optimize!(model)

julia> value(x), value(t)
(0.9999999965101495, 2.718281790607327)

(mzn) pkg> st
Status `/private/tmp/mzn/Project.toml`
  [61c947e1] Clarabel v0.8.1
  [f65535da] Convex v0.16.0
  [4076af6c] JuMP v1.22.1

I'll close. Re-open if you have a reproducible example.

blegat commented 4 months ago

Looking at it again, it was my mistake, it's actually working, sorry for the noise.