It seems like you’re having trouble installing things, so hopefully the example below helps.
Related posts:
Make sure you’re using Julia 1.6 or 1.7. Do not use JuliaPro or Julia 1.5.
(base) oscar@Oscars-MBP Documents % mkdir discourse
(base) oscar@Oscars-MBP Documents % cd discourse
(base) oscar@Oscars-MBP discourse % ~/julia --project=.
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.6.2 (2021-07-14)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
(discourse) pkg> st
Status `~/Documents/discourse/Project.toml` (empty project)
(discourse) pkg> add Bonmin_jll AmplNLWriter JuMP
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Installed AmplNLWriter ─ v0.8.1
Updating `~/Documents/discourse/Project.toml`
[7c4d4715] + AmplNLWriter v0.8.1
[4076af6c] + JuMP v0.23.1
[29cba6d7] + Bonmin_jll v100.800.801+0
Updating `~/Documents/discourse/Manifest.toml`
[7c4d4715] + AmplNLWriter v0.8.1
[6e4b80f9] + BenchmarkTools v1.3.1
[49dc2e85] + Calculus v0.5.1
[d360d2e6] + ChainRulesCore v1.13.0
[9e997f8a] + ChangesOfVariables v0.1.2
[523fee87] + CodecBzip2 v0.7.2
[944b1d66] + CodecZlib v0.7.0
[bbf7d656] + CommonSubexpressions v0.3.0
[34da2185] + Compat v3.42.0
[864edb3b] + DataStructures v0.18.11
[163ba53b] + DiffResults v1.0.3
[b552c78f] + DiffRules v1.10.0
[ffbed154] + DocStringExtensions v0.8.6
[f6369f11] + ForwardDiff v0.10.25
[3587e190] + InverseFunctions v0.1.3
[92d709cd] + IrrationalConstants v0.1.1
[692b3bcd] + JLLWrappers v1.4.1
[682c06a0] + JSON v0.21.3
[4076af6c] + JuMP v0.23.1
[2ab3a3ac] + LogExpFunctions v0.3.7
[1914dd2f] + MacroTools v0.5.9
[b8f27783] + MathOptInterface v1.1.0
[d8a4904e] + MutableArithmetics v1.0.0
[77ba4419] + NaNMath v0.3.7
[bac558e1] + OrderedCollections v1.4.1
[69de0a69] + Parsers v2.2.3
[21216c6a] + Preferences v1.2.4
[276daf66] + SpecialFunctions v2.1.4
[90137ffa] + StaticArrays v1.4.1
[3bb67fe8] + TranscodingStreams v0.9.6
[ae81ac8f] + ASL_jll v0.1.3+0
[29cba6d7] + Bonmin_jll v100.800.801+0
[6e34b625] + Bzip2_jll v1.0.8+0
[38041ee0] + Cbc_jll v200.1000.501+0
[3830e938] + Cgl_jll v0.6000.300+0
[06985876] + Clp_jll v100.1700.601+0
[be027038] + CoinUtils_jll v200.1100.400+0
[9cc047cb] + Ipopt_jll v300.1400.400+0
[d00139f3] + METIS_jll v5.1.1+0
[d7ed1dd3] + MUMPS_seq_jll v5.4.1+0
[656ef2d0] + OpenBLAS32_jll v0.3.12+1
[efe28fd5] + OpenSpecFun_jll v0.5.5+0
[7da25872] + Osi_jll v0.10800.600+0
[0dad84c5] + ArgTools
[56f22d72] + Artifacts
[2a0f44e3] + Base64
[ade2ca70] + Dates
[8bb1440f] + DelimitedFiles
[8ba89e20] + Distributed
[f43a241f] + Downloads
[b77e0a4c] + InteractiveUtils
[b27032c2] + LibCURL
[76f85450] + LibGit2
[8f399da3] + Libdl
[37e2e46d] + LinearAlgebra
[56ddb016] + Logging
[d6f4376e] + Markdown
[a63ad114] + Mmap
[ca575930] + NetworkOptions
[44cfe95a] + Pkg
[de0858da] + Printf
[9abbd945] + Profile
[3fa0cd96] + REPL
[9a3f8284] + Random
[ea8e919c] + SHA
[9e88b42a] + Serialization
[1a1011a3] + SharedArrays
[6462fe0b] + Sockets
[2f01184e] + SparseArrays
[10745b16] + Statistics
[fa267f1f] + TOML
[a4e569a6] + Tar
[8dfed614] + Test
[cf7118a7] + UUIDs
[4ec0a83e] + Unicode
[e66e0078] + CompilerSupportLibraries_jll
[deac9b47] + LibCURL_jll
[29816b5a] + LibSSH2_jll
[c8ffd9c3] + MbedTLS_jll
[14a3606d] + MozillaCACerts_jll
[05823500] + OpenLibm_jll
[83775a58] + Zlib_jll
[8e850ede] + nghttp2_jll
[3f19e933] + p7zip_jll
Precompiling project...
1 dependency successfully precompiled in 4 seconds (47 already precompiled)
(discourse) pkg> st
Status `~/Documents/discourse/Project.toml`
[7c4d4715] AmplNLWriter v0.8.1
[4076af6c] JuMP v0.23.1
[29cba6d7] Bonmin_jll v100.800.801+0
julia> using JuMP, AmplNLWriter, Bonmin_jll
[ Info: Precompiling JuMP [4076af6c-e467-56ae-b986-b466b2749572]
[ Info: Precompiling Bonmin_jll [29cba6d7-6840-5cf2-a2fa-9bdfccfe29ea]
julia> model = Model(() -> AmplNLWriter.Optimizer(Bonmin_jll.amplexe))
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: AmplNLWriter
julia> @variable(model, x >= 0.5, Int)
x
julia> @objective(model, Min, x)
x
julia> optimize!(model)
Bonmin 1.8.8 using Cbc 2.10.5 and Ipopt 3.14.4
bonmin:
******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Eclipse Public License (EPL).
For more information visit https://github.com/coin-or/Ipopt
******************************************************************************
NLP0012I
Num Status Obj It time Location
NLP0014I 1 OPT 0.5 2 0.008324
NLP0014I 2 OPT 0.5 0 0
NLP0014I 3 OPT 0.99999999 3 0.007858
Cbc0010I After 0 nodes, 1 on tree, 1e+50 best solution, best possible -1.7976931e+308 (0.01 seconds)
NLP0014I 4 OPT 0.5 0 0
NLP0012I
Num Status Obj It time Location
NLP0014I 1 OPT 1 0 0
Cbc0004I Integer solution of 1 found after 0 iterations and 1 nodes (0.01 seconds)
NLP0014I 5 OPT 0.99999999 3 0.007734
Cbc0001I Search completed - best objective 1, took 3 iterations and 2 nodes (0.02 seconds)
Cbc0032I Strong branching done 1 times (3 iterations), fathomed 0 nodes and fixed 0 variables
Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost
"Finished"
julia> solution_summary(model)
* Solver : AmplNLWriter
* Status
Termination status : LOCALLY_SOLVED
Primal status : FEASIBLE_POINT
Dual status : NO_SOLUTION
Message from the solver:
"bonmin: OptimalOptions"
* Candidate solution
Objective value : 1.00000e+00
Dual objective value : 1.00000e+00
* Work counters
Solve time (sec) : 1.07892e+00