Note: The following exercises are inspired by and adapted from juliaopt-notebook
In [3]:
Pkg.add("JuMP")
INFO: Nothing to be done
In [ ]:
Pkg.test("JuMP")
INFO: Computing test dependencies for JuMP...
INFO: Cloning cache of ECOS from git://github.com/JuliaOpt/ECOS.jl.git
INFO: Cloning cache of Ipopt from git://github.com/JuliaOpt/Ipopt.jl.git
INFO: Cloning cache of SCS from git://github.com/JuliaOpt/SCS.jl.git
INFO: Installing ECOS v0.6.2
INFO: Installing Ipopt v0.2.1
INFO: Installing SCS v0.2.1
INFO: Building Homebrew
HEAD is now at 53c5089 CoreTap#install: fix clone target setting
HEAD is now at c377b50 Merge pull request #92 from staticfloat/staging
INFO: Building ECOS
==> Installing ecos from staticfloat/juliadeps
==> Downloading https://juliabottles.s3.amazonaws.com/ecos-2.0.4.el_capitan.bottle.tar.gz
Error: Failed to download resource "ecos"
Download failed: https://juliabottles.s3.amazonaws.com/ecos-2.0.4.el_capitan.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading https://github.com/embotech/ecos/archive/v2.0.4.tar.gz
==> Downloading from https://codeload.github.com/embotech/ecos/tar.gz/v2.0.4
==> make shared
==> make test
🍺 /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/ecos/2.0.4: 19 files, 4.6M, built in 26 seconds
Warning: Already linked: /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/ecos/2.0.4
INFO: Building Ipopt
==> Installing ipopt from staticfloat/juliadeps
==> Installing dependencies for staticfloat/juliadeps/ipopt: staticfloat/juliadeps/libgfortran
==> Installing staticfloat/juliadeps/ipopt dependency: staticfloat/juliadeps/libgfortran
==> Downloading https://juliabottles.s3.amazonaws.com/libgfortran-5.2.el_capitan.bottle.tar.gz
==> Installing dependencies for staticfloat/juliadeps/libgfortran: mpfr, libmpc, isl, gcc
==> Installing staticfloat/juliadeps/libgfortran dependency: mpfr
==> Downloading https://homebrew.bintray.com/bottles/mpfr-3.1.3.el_capitan.bottle.tar.gz
Error: Failed to download resource "libgfortran"
Download failed: https://juliabottles.s3.amazonaws.com/libgfortran-5.2.el_capitan.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Pouring mpfr-3.1.3.el_capitan.bottle.tar.gz
🍺 /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/mpfr/3.1.3: 25 files, 3.5M
==> Installing staticfloat/juliadeps/libgfortran dependency: libmpc
==> Downloading https://homebrew.bintray.com/bottles/libmpc-1.0.3.el_capitan.bottle.tar.gz
==> Pouring libmpc-1.0.3.el_capitan.bottle.tar.gz
🍺 /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/libmpc/1.0.3: 11 files, 350.1K
==> Installing staticfloat/juliadeps/libgfortran dependency: isl
==> Downloading https://homebrew.bintray.com/bottles/isl-0.15.el_capitan.bottle.tar.gz
==> Pouring isl-0.15.el_capitan.bottle.tar.gz
🍺 /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/isl/0.15: 70 files, 3.6M
==> Installing staticfloat/juliadeps/libgfortran dependency: gcc
Warning: Building gcc from source:
The bottle needs the Xcode CLT to be installed.
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-5.3.0/gcc-5.3.0.tar.bz2
==> Downloading from http://mirrors.opencas.cn/gnu/gcc/gcc-5.3.0/gcc-5.3.0.tar.bz2
==> Patching
patching file gcc/jit/Make-lang.in
patching file gcc/jit/jit-playback.c
Hunk #1 succeeded at 2470 with fuzz 2 (offset 54 lines).
==> ../configure --build=x86_64-apple-darwin15.2.0 --prefix=/Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/gcc/5.3.0 --libdir=/Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/gcc/5.3.0/lib/gcc/5 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-5 --with-gmp=/Users/utensil/.julia/v0.4/Homebrew/deps/usr/opt/gmp --with-mpfr=/Users/utensil/.julia/v0.4/Homebrew/deps/usr/opt/mpfr --with-mpc=/Users/utensil/.julia/v0.4/Homebrew/deps/usr/opt/libmpc --with-isl=/Users/utensil/.julia/v0.4/Homebrew/deps/usr/opt/isl --with-system-zlib --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --with-build-config=bootstrap-debug --disable-werror --with-pkgversion=Homebrew gcc 5.3.0 --with-bugurl=https://github.com/Homebrew/homebrew/issues --enable-plugin --disable-nls --enable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
==> make bootstrap
==> make install
==> Caveats
GCC has been built with multilib support. Notably, OpenMP may not work:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670
If you need OpenMP support you may want to
brew reinstall gcc --without-multilib
==> Summary
🍺 /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/gcc/5.3.0: 1,390 files, 254.9M, built in 57 minutes 52 seconds
==> Downloading https://github.com/staticfloat/homebrew-libgfortran-formula/archive/master.tar.gz
==> Downloading from https://codeload.github.com/staticfloat/homebrew-libgfortran-formula/tar.gz/master
==> cp /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/gcc/5.3.0/lib/gcc/5/libquadmath.0.dylib /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/libgfortran/5.2/lib
==> cp /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/gcc/5.3.0/lib/gcc/5/libgcc_s.1.dylib /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/libgfortran/5.2/lib
==> cp /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/gcc/5.3.0/lib/gcc/5/libgfortran.3.dylib /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/libgfortran/5.2/lib
Warning: SHA1 support is deprecated and will be removed in a future version.
Please switch this formula to SHA256.
🍺 /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/libgfortran/5.2: 8 files, 2M, built in 9 seconds
==> Installing staticfloat/juliadeps/ipopt
==> Downloading https://juliabottles.s3.amazonaws.com/ipopt-3.12.4.el_capitan.bottle.tar.gz
==> Pouring ipopt-3.12.4.el_capitan.bottle.tar.gz
🍺 /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/ipopt/3.12.4: 91 files, 5.8M
Warning: Already linked: /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/ipopt/3.12.4
INFO: Building SCS
==> Installing scs from staticfloat/juliadeps
==> Downloading https://juliabottles.s3.amazonaws.com/scs-1.1.8.el_capitan.bottle.tar.gz
Error: Failed to download resource "scs"
Download failed: https://juliabottles.s3.amazonaws.com/scs-1.1.8.el_capitan.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading https://github.com/cvxgrp/scs/archive/v1.1.8.tar.gz
==> Downloading from https://codeload.github.com/cvxgrp/scs/tar.gz/v1.1.8
==> make out/libscsdir.dylib
==> make purge
==> make out/libscsdir.dylib
🍺 /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/scs/1.1.8: 5 files, 165.1K, built in 29 seconds
Warning: Already linked: /Users/utensil/.julia/v0.4/Homebrew/deps/usr/Cellar/scs/1.1.8
INFO: Testing JuMP
INFO: Recompiling stale cache file /Users/utensil/.julia/lib/v0.4/JuMP.ji for module JuMP.
INFO: Recompiling stale cache file /Users/utensil/.julia/lib/v0.4/ForwardDiff.ji for module ForwardDiff.
WARNING: New definition
atan2(ForwardDiff.GradientNumber, Real) at /Users/utensil/.julia/v0.4/ForwardDiff/src/GradientNumber.jl:208
is ambiguous with:
atan2(Real, ForwardDiff.GradientNumber) at /Users/utensil/.julia/v0.4/ForwardDiff/src/GradientNumber.jl:208.
To fix, define
atan2(ForwardDiff.GradientNumber, ForwardDiff.GradientNumber)
before the new definition.
WARNING: New definition
*(Real, ForwardDiff.HessianNumber) at /Users/utensil/.julia/v0.4/ForwardDiff/src/HessianNumber.jl:98
is ambiguous with:
*(ForwardDiff.HessianNumber, Real) at /Users/utensil/.julia/v0.4/ForwardDiff/src/HessianNumber.jl:97.
To fix, define
*(ForwardDiff.HessianNumber, ForwardDiff.HessianNumber)
before the new definition.
WARNING: New definition
/(Real, ForwardDiff.HessianNumber) at /Users/utensil/.julia/v0.4/ForwardDiff/src/HessianNumber.jl:126
is ambiguous with:
/(ForwardDiff.HessianNumber, Real) at /Users/utensil/.julia/v0.4/ForwardDiff/src/HessianNumber.jl:123.
To fix, define
/(ForwardDiff.HessianNumber, ForwardDiff.HessianNumber)
before the new definition.
WARNING: New definition
^(Real, ForwardDiff.HessianNumber) at /Users/utensil/.julia/v0.4/ForwardDiff/src/HessianNumber.jl:176
is ambiguous with:
^(ForwardDiff.HessianNumber, Real) at /Users/utensil/.julia/v0.4/ForwardDiff/src/HessianNumber.jl:167.
To fix, define
^(ForwardDiff.HessianNumber, ForwardDiff.HessianNumber)
before the new definition.
WARNING: New definition
atan2(ForwardDiff.HessianNumber, Real) at /Users/utensil/.julia/v0.4/ForwardDiff/src/HessianNumber.jl:268
is ambiguous with:
atan2(Real, ForwardDiff.HessianNumber) at /Users/utensil/.julia/v0.4/ForwardDiff/src/HessianNumber.jl:268.
To fix, define
atan2(ForwardDiff.HessianNumber, ForwardDiff.HessianNumber)
before the new definition.
WARNING: New definition
*(Real, ForwardDiff.TensorNumber) at /Users/utensil/.julia/v0.4/ForwardDiff/src/TensorNumber.jl:107
is ambiguous with:
*(ForwardDiff.TensorNumber, Real) at /Users/utensil/.julia/v0.4/ForwardDiff/src/TensorNumber.jl:106.
To fix, define
*(ForwardDiff.TensorNumber, ForwardDiff.TensorNumber)
before the new definition.
WARNING: New definition
/(Real, ForwardDiff.TensorNumber) at /Users/utensil/.julia/v0.4/ForwardDiff/src/TensorNumber.jl:142
is ambiguous with:
/(ForwardDiff.TensorNumber, Real) at /Users/utensil/.julia/v0.4/ForwardDiff/src/TensorNumber.jl:139.
To fix, define
/(ForwardDiff.TensorNumber, ForwardDiff.TensorNumber)
before the new definition.
WARNING: New definition
^(Real, ForwardDiff.TensorNumber) at /Users/utensil/.julia/v0.4/ForwardDiff/src/TensorNumber.jl:211
is ambiguous with:
^(ForwardDiff.TensorNumber, Real) at /Users/utensil/.julia/v0.4/ForwardDiff/src/TensorNumber.jl:197.
To fix, define
^(ForwardDiff.TensorNumber, ForwardDiff.TensorNumber)
before the new definition.
WARNING: New definition
atan2(ForwardDiff.TensorNumber, Real) at /Users/utensil/.julia/v0.4/ForwardDiff/src/TensorNumber.jl:332
is ambiguous with:
atan2(Real, ForwardDiff.TensorNumber) at /Users/utensil/.julia/v0.4/ForwardDiff/src/TensorNumber.jl:332.
To fix, define
atan2(ForwardDiff.TensorNumber, ForwardDiff.TensorNumber)
before the new definition.
INFO: Recompiling stale cache file /Users/utensil/.julia/lib/v0.4/ReverseDiffSparse.ji for module ReverseDiffSparse.
[print] JuMPContainer{Variable}
> bound printing
> index set printing
> category printing
> Empty JuMPContainer printing (#124)
108 facts verified.
[print] JuMPContainer{Number}
6 facts verified.
[print] SOS constraints
6 facts verified.
[print] Model
8 facts verified.
[print] changing variable categories
2 facts verified.
[print] expressions
9 facts verified.
[print] Variable
32 facts verified.
[print] User-created Array{Variable}
6 facts verified.
[print] basename keyword argument
15 facts verified.
[variable] constructors
11 facts verified.
[variable] get and set bounds
14 facts verified.
[variable] get and set values
3 facts verified.
[variable] get and set category
2 facts verified.
[variable] repeated elements in index set (issue #199)
1 fact verified.
[variable] condition in indexing
3 facts verified.
[variable] @variable returning Array{Variable}
WARNING: Variable value not defined for component of x. Check that the model was properly solved.
6 facts verified.
[variable] getvalue on empty things
WARNING: Variable value not defined for component of z. Check that the model was properly solved.
5 facts verified.
[variable] Slices of JuMPArray (#684)
33 facts verified.
[variable] Can't use end for indexing a JuMPContainer
6 facts verified.
[expr] Test expression construction
> AffExpr
> QuadExpr
8 facts verified.
[expr] Test getvalue(expr)
2 facts verified.
[expr] Test expression iterators
4 facts verified.
[operator] Testing basic operator overloads
> Number--???
> Variable--???
> Norm--???
> AffExpr--???
> QuadExpr--???
> SOCExpr--???
290 facts verified.
[operator] Higher-level operators
> sum
> dot
18 facts verified.
Vectorized operations
> Transpose
> Vectorized arithmetic
> Dot-ops
> Vectorized comparisons
86 facts verified.
[operator] JuMPArray concatenation
9 facts verified.
[macros] Check Julia expression parsing
13 facts verified.
[macros] Check @constraint basics
11 facts verified.
[macros] Checking @variable with reverse direction bounds
2 facts verified.
[macros] sum{}
5 facts verified.
[macros] Problem modification
4 facts verified.
[macros] Using pre-built affine is OK in macro
4 facts verified.
[macros] Test ranges in @variable
10 facts verified.
[macros] Unicode comparisons
9 facts verified.
[macros] Three argument @constraint
3 facts verified.
[macros] @constraints
4 facts verified.
[macros] @NLconstraints
5 facts verified.
[macros] Vectors in nonlinear expressions
2 facts verified.
[macros] @objective with quadratic
1 fact verified.
[macros] @constraint with quadratic
13 facts verified.
[macros] Triangular indexing, iteration
158 facts verified.
[macros] Multidimensional indexing
1 fact verified.
WARNING: The two-argument version of @defExpr is deprecated. The corresponding JuMP model is now required as the first argument. The new syntax is @expression(<JuMP model>, <name of expression(s)>, <expression>)
WARNING: The one-argument version of @defExpr is deprecated. The corresponding JuMP model is now required as the first argument, and a name for the expression or collection of expressions is required as the second argument. The new syntax is @expression(<JuMP model>, <name of expression(s)>, <expression>)
[macros] @expression
6 facts verified.
[macros] Conditions in constraint indexing
7 facts verified.
[macros] Test changes in condition parsing
4 facts verified.
[macros] Norm parsing
5 facts verified.
[macros] Extraneous terms in QuadExpr (#535)
1 fact verified.
[macros] Special-case binary multiplication in addtoexpr_reorder (#537)
3 facts verified.
[macros] Indices in macros don't leak out of scope (#582)
25 facts verified.
[macros] Issue #621
1 fact verified.
[macros] @variables and @constraints
13 facts verified.
[macros] No bare symbols in constraint macros
6 facts verified.
[macros] LB/UB kwargs
6 facts verified.
[fuzzer] Check macros for expression construction
[model] Check error cases
WARNING: Variable value not defined for errVar. Check that the model was properly solved.
6 facts verified.
[model] Performance warnings
WARNING: Variable value not defined for x. Check that the model was properly solved.
WARNING: The addition operator has been used on JuMP expressions a large number of times. This warning is safe to ignore but may indicate that model generation is slower than necessary. For performance reasons, you should not add expressions in a loop. Instead of x += y, use append!(x,y) to modify x in place. If y is a single variable, you may also use push!(x, coef, y) in place of x += coef*y.
0 facts verified.
[model] Test printing a model
Warning, MPS does not support maximization sense. Flipping objective coefficients.
65 facts verified.
[model] Quadratic MPS writer
20 facts verified.
[model] Test solving a MILP
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
20 facts verified.
[model] Test solving an LP (Min)
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
> With solver Ipopt.IpoptSolver
******************************************************************************
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 http://projects.coin-or.org/Ipopt
******************************************************************************
> With solver ECOS.ECOSSolver
> With solver SCS.SCSSolver
95 facts verified.
[model] Test solving an LP (Max)
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
> With solver Ipopt.IpoptSolver
> With solver ECOS.ECOSSolver
> With solver SCS.SCSSolver
95 facts verified.
[model] Test binary variable handling
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
4 facts verified.
[model] Test model copying
28 facts verified.
[model] Test variable/model 'hygiene'
> Linear constraint
> Linear objective
> Quadratic constraint
> Affine in quadratic constraint
> Quadratic objective
5 facts verified.
[model] Test NaN checking
3 facts verified.
[model] Test column-wise modeling
9 facts verified.
[model] Test all MPS paths
Warning, MPS does not support maximization sense. Flipping objective coefficients.
0 facts verified.
[model] Test all LP paths
1 fact verified.
[model] Test semi-continuous variables
0 facts verified.
[model] Test semi-integer variables
0 facts verified.
[model] Test fixed variables don't leak through MPB
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
> With solver Ipopt.IpoptSolver
> With solver ECOS.ECOSSolver
> With solver SCS.SCSSolver
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
WARNING: Ignoring partial starting solution. Cbc requires a feasible value to be specified for all variables.
27 facts verified.
[model] Test SOS constraints
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
WARNING: Solver does not appear to support providing initial feasible solutions.
Cbc3007W No integer variables - nothing to do
Cbc3007W No integer variables - nothing to do
10 facts verified.
[model] Test vectorized model creation
2 facts verified.
[model] Test MIQP vectorization
2 facts verified.
[model] Test setsolver
26 facts verified.
[model] Setting solve hook
2 facts verified.
[model] Setting print hook
1 fact verified.
[model] Test linearindex
5 facts verified.
[model] Test LinearConstraint from ConstraintRef
1 fact verified.
[model] Test getvalue on OneIndexedArrays
2 facts verified.
[model] Relaxation keyword argument to solve
24 facts verified.
[model] Unrecognized keyword argument to solve
1 fact verified.
[probmod] Testing problem modification basics
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
> With solver Ipopt.IpoptSolver
> With solver ECOS.ECOSSolver
> With solver SCS.SCSSolver
65 facts verified.
[probmod] Testing problem modification part two
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
WARNING: Solver does not appear to support adding variables to an existing model. Hot-start is disabled.
WARNING: Solver does not appear to support hot-starts. Model will be built from scratch.
Presolve 0 (-1) rows, 0 (-3) columns and 0 (-3) elements
Optimal - objective value 3.3
After Postsolve, objective 3.3, infeasibilities - dual 0.9999999 (1), primal 0 (0)
Presolved model was optimal, full model needs cleaning up
0 Obj 3.3 Dual inf 0.9999999 (1)
1 Obj 3.3
Optimal - objective value 3.3
Optimal objective 3.3 - 1 iterations time 0.002, Presolve 0.00
Cbc0045I Solution with objective value -3.3 saved
Presolve 0 (-3) rows, 0 (-3) columns and 0 (-7) elements
Optimal - objective value 2.2
After Postsolve, objective 2.2, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective 2.2 - 0 iterations time 0.002, Presolve 0.00
Cbc0045I Solution with objective value -2.2 saved
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
WARNING: Solver does not appear to support adding constraints to an existing model. Hot-start is disabled.
36 facts verified.
[probmod] Test adding a range constraint and modifying it
1 fact verified.
[probmod] Test adding a 'decoupled' variable (#205)
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
Presolve 0 (-3) rows, 0 (-3) columns and 0 (-7) elements
Optimal - objective value 101.1
After Postsolve, objective 101.1, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective 101.1 - 0 iterations time 0.002, Presolve 0.00
Cbc0045I Solution with objective value -101.1 saved
> With solver Ipopt.IpoptSolver
> With solver ECOS.ECOSSolver
> With solver SCS.SCSSolver
10 facts verified.
[probmod] Test JuMP.build
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
> With solver Ipopt.IpoptSolver
> With solver ECOS.ECOSSolver
> With solver SCS.SCSSolver
40 facts verified.
[probmod] Test JuMP.build with MIP
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
12 facts verified.
[probmod] Test adding empty constraints
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
> With solver Ipopt.IpoptSolver
> With solver ECOS.ECOSSolver
> With solver SCS.SCSSolver
10 facts verified.
[probmod] Test bound modification on binaries
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
Optimal - objective value 1
Optimal objective 1 - 0 iterations time 0.002
Cbc0045I Solution with objective value -1 saved
Optimal - objective value 0
Optimal objective 0 - 0 iterations time 0.002
Cbc0045I Solution with objective value 0 saved
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
12 facts verified.
[probmod] Applicable regressions
> Clp
> Cbc
> GLPK LP
> GLPK MIP
72 facts verified.
[callback] Test lazy constraints
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
8 facts verified.
[callback] Test user cuts
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
3 facts verified.
[callback] Test heuristics
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
WARNING: Ignoring infeasible solution from heuristic callback
6 facts verified.
[callback] Test informational callback
0 facts verified.
[callback] Callback exit on CallbackAbort
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
WARNING: Not solved to optimality, status: UserLimit
1 fact verified.
[qcqpmodel] Test quad objective (discrete)
0 facts verified.
[qcqpmodel] Test quad objective (continuous)
> With solver Ipopt.IpoptSolver
9 facts verified.
[qcqpmodel] Test quad constraints (continuous)
> With solver Ipopt.IpoptSolver
19 facts verified.
[qcqpmodel] Test SOC constraints (continuous)
> With solver ECOS.ECOSSolver
> With solver SCS.SCSSolver
32 facts verified.
[qcqpmodel] Test SOC duals
> With solver ECOS.ECOSSolver
> With solver SCS.SCSSolver
20 facts verified.
[qcqpmodel] Test quad constraints (discrete)
0 facts verified.
[qcqpmodel] Test simple normed problem
> With solver ECOS.ECOSSolver
> With solver SCS.SCSSolver
10 facts verified.
[qcqpmodel] Test quad problem modification
> With solver Ipopt.IpoptSolver
10 facts verified.
[qcqpmodel] Rotated second-order cones
0 facts verified.
[nonlinear] Test getvalue on arrays
5 facts verified.
[nonlinear] Test HS071 solves correctly
> With solver Ipopt.IpoptSolver
> With solver NLopt.NLoptSolver
6 facts verified.
WARNING: Nonlinear solver does not provide dual solutions
[nonlinear] Test HS071 solves correctly, epigraph
> With solver Ipopt.IpoptSolver
> With solver NLopt.NLoptSolver
4 facts verified.
[nonlinear] Test ifelse
> With solver Ipopt.IpoptSolver
2 facts verified.
[nonlinear] Accepting fixed variables
> With solver Ipopt.IpoptSolver, simplify = true
> With solver Ipopt.IpoptSolver, simplify = false
> With solver NLopt.NLoptSolver, simplify = true
> With solver NLopt.NLoptSolver, simplify = false
16 facts verified.
[nonlinear] Test QP solve through NL pathway
> With solver Ipopt.IpoptSolver
> With solver NLopt.NLoptSolver
16 facts verified.
[nonlinear] Test quad con solve through NL pathway
> With solver Ipopt.IpoptSolver
> With solver NLopt.NLoptSolver
6 facts verified.
[nonlinear] Test resolve with parameter
> With solver Ipopt.IpoptSolver, simplify = true
> With solver Ipopt.IpoptSolver, simplify = false
> With solver NLopt.NLoptSolver, simplify = true
> With solver NLopt.NLoptSolver, simplify = false
16 facts verified.
[nonlinear] Test two-sided nonlinear constraints
> With solver Ipopt.IpoptSolver
> With solver NLopt.NLoptSolver
8 facts verified.
[nonlinear] Quadratic equality constraints
> With solver Ipopt.IpoptSolver
> With solver NLopt.NLoptSolver
WARNING: Not solved to optimality, status: Suboptimal
Failure :: (line:505) :: With solver NLopt.NLoptSolver :: fact was false
Expression: status --> :(:Optimal)
Expected: :Optimal
Occurred: :Suboptimal
Failure :: (line:505) :: With solver NLopt.NLoptSolver :: fact was false
Expression: getvalue(x) --> roughly([sqrt(1 / 2),0],1.0e-6)
Expected: [0.0,0.0] ≅ [0.7071067811865476,0.0]
Out of 4 total facts:
Verified: 2
Failed: 2
[nonlinear] Test mixed integer nonlinear problems
0 facts verified.
[nonlinear] Test continuous relaxation of minlp test problem
> With solver Ipopt.IpoptSolver
> With solver NLopt.NLoptSolver
10 facts verified.
[nonlinear] Test maximization objective
> With solver Ipopt.IpoptSolver
> With solver NLopt.NLoptSolver
6 facts verified.
WARNING: in @NLexpression(quadexpr2,x + x ^ 2 + x * y + y ^ 2): three arguments are required.
Note that the syntax of @NLexpression has recently changed:
The first argument should be the model to which the expression is attached.
The second is the name of the expression (or collection of expressions).
The third is the expression itself.
Example:
@NLexpression(m, my_expr, x^2/y)
@NLexpression(m, my_expr_collection[i=1:2], sin(z[i])^2)
Support for the old syntax (with the model omitted) will be removed in an upcoming release.
WARNING: in @NLexpression(x + x ^ 2 + x * y + y ^ 2): three arguments are required.
Note that the syntax of @NLexpression has recently changed:
The first argument should be the model to which the expression is attached.
The second is the name of the expression (or collection of expressions).
The third is the expression itself.
Example:
@NLexpression(m, my_expr, x^2/y)
@NLexpression(m, my_expr_collection[i=1:2], sin(z[i])^2)
Support for the old syntax (with the model omitted) will be removed in an upcoming release.
[nonlinear] Test maximization objective (embedded expressions)
> With solver Ipopt.IpoptSolver, simplify = true
> With solver Ipopt.IpoptSolver, simplify = false
> With solver NLopt.NLoptSolver, simplify = true
> With solver NLopt.NLoptSolver, simplify = false
24 facts verified.
[nonlinear] Test infeasibility detection
> With solver Ipopt.IpoptSolver
1 fact verified.
[nonlinear] Test unboundedness detection
> With solver Ipopt.IpoptSolver
1 fact verified.
[nonlinear] Test entropy maximization
> With solver Ipopt.IpoptSolver
> With solver NLopt.NLoptSolver
4 facts verified.
[nonlinear] Test entropy maximization (reformulation)
> With solver Ipopt.IpoptSolver
> With solver NLopt.NLoptSolver
In [1]:
for pkg in ["GLPKMathProgInterface", "Cbc", "Clp"]
Pkg.add(pkg)
end
INFO: Nothing to be done
INFO: Nothing to be done
INFO: Nothing to be done
In [2]:
for pkg in ["GLPKMathProgInterface", "Cbc", "Clp"]
Pkg.test(pkg)
end
INFO: Testing GLPKMathProgInterface
Testing linprog with solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
WARNING: Element type Int64 does not have an infinite value. Note that this may artifically introduce ranged (two-sided) constraints. To avoid this, consider casting the problem data to Float64.
Passed
Testing mixintprog with solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
Done
Problem LIN1
Problem LIN1A
Problem LIN2
Problem LIN2A
Problem LIN3
Problem LIN4
Problem LIN1
Problem LIN1A
Problem LIN2
Problem LIN2A
Problem LIN3
glp_intopt: optimal basis to initial LP relaxation not provided
Problem LIN4
glp_intopt: optimal basis to initial LP relaxation not provided
INFO: GLPKMathProgInterface tests passed
INFO: Computing test dependencies for Cbc...
INFO: No packages to install, update or remove
INFO: Testing Cbc
Solution status: Optimal
Optimal value: -7.0
Solution vector: [1.0,1.0,0.0,0.0,1.0]
Testing mixintprog with solver Cbc.CbcMathProgSolverInterface.CbcSolver
Done
Cgl0004I processed model has 1 rows, 5 columns (5 integer (5 of which binary)) and 5 elements
Cutoff increment increased from 1e-05 to 0.9999
Cbc0038I Initial state - 1 integers unsatisfied sum - 0.25
Cbc0038I Solution found of -16
Cbc0038I Before mini branch and bound, 4 integers at bound fixed and 0 continuous
Cbc0038I Mini branch and bound did not improve solution (0.00 seconds)
Cbc0038I After 0.00 seconds - Feasibility pump exiting with objective of -16 - took 0.00 seconds
Cbc0012I Integer solution of -16 found by feasibility pump after 0 iterations and 0 nodes (0.00 seconds)
Cbc0001I Search completed - best objective -16, took 1 iterations and 0 nodes (0.00 seconds)
Cbc0035I Maximum depth 0, 4 variables fixed on reduced cost
Total time (CPU seconds): 0.00 (Wallclock seconds): 0.00
Problem LIN1
Problem LIN1A
Problem LIN2
Problem LIN2A
Problem LIN3
Problem LIN4
[print] JuMPContainer{Variable}
> bound printing
> index set printing
> category printing
> Empty JuMPContainer printing (#124)
108 facts verified.
[print] JuMPContainer{Number}
6 facts verified.
[print] SOS constraints
6 facts verified.
[print] Model
8 facts verified.
[print] changing variable categories
2 facts verified.
[print] expressions
9 facts verified.
[print] Variable
32 facts verified.
[print] User-created Array{Variable}
6 facts verified.
[print] basename keyword argument
15 facts verified.
[variable] constructors
11 facts verified.
[variable] get and set bounds
14 facts verified.
[variable] get and set values
3 facts verified.
[variable] get and set category
2 facts verified.
[variable] repeated elements in index set (issue #199)
1 fact verified.
[variable] condition in indexing
3 facts verified.
[variable] @variable returning Array{Variable}
6 facts verified.
WARNING: Variable value not defined for component of x. Check that the model was properly solved.
WARNING: Variable value not defined for component of z. Check that the model was properly solved.
[variable] getvalue on empty things
5 facts verified.
[variable] Slices of JuMPArray (#684)
33 facts verified.
[variable] Can't use end for indexing a JuMPContainer
6 facts verified.
[expr] Test expression construction
> AffExpr
> QuadExpr
8 facts verified.
[expr] Test getvalue(expr)
2 facts verified.
[expr] Test expression iterators
4 facts verified.
[operator] Testing basic operator overloads
> Number--???
> Variable--???
> Norm--???
> AffExpr--???
> QuadExpr--???
> SOCExpr--???
290 facts verified.
[operator] Higher-level operators
> sum
> dot
18 facts verified.
Vectorized operations
> Transpose
> Vectorized arithmetic
> Dot-ops
> Vectorized comparisons
86 facts verified.
[operator] JuMPArray concatenation
9 facts verified.
[macros] Check Julia expression parsing
13 facts verified.
[macros] Check @constraint basics
11 facts verified.
[macros] Checking @variable with reverse direction bounds
2 facts verified.
[macros] sum{}
5 facts verified.
[macros] Problem modification
4 facts verified.
[macros] Using pre-built affine is OK in macro
4 facts verified.
[macros] Test ranges in @variable
10 facts verified.
[macros] Unicode comparisons
9 facts verified.
[macros] Three argument @constraint
3 facts verified.
[macros] @constraints
4 facts verified.
[macros] @NLconstraints
5 facts verified.
[macros] Vectors in nonlinear expressions
2 facts verified.
[macros] @objective with quadratic
1 fact verified.
[macros] @constraint with quadratic
13 facts verified.
[macros] Triangular indexing, iteration
158 facts verified.
[macros] Multidimensional indexing
1 fact verified.
[macros] @expression
WARNING: The two-argument version of @defExpr is deprecated. The corresponding JuMP model is now required as the first argument. The new syntax is @expression(<JuMP model>, <name of expression(s)>, <expression>)
WARNING: The one-argument version of @defExpr is deprecated. The corresponding JuMP model is now required as the first argument, and a name for the expression or collection of expressions is required as the second argument. The new syntax is @expression(<JuMP model>, <name of expression(s)>, <expression>)
6 facts verified.
[macros] Conditions in constraint indexing
7 facts verified.
[macros] Test changes in condition parsing
4 facts verified.
[macros] Norm parsing
5 facts verified.
[macros] Extraneous terms in QuadExpr (#535)
1 fact verified.
[macros] Special-case binary multiplication in addtoexpr_reorder (#537)
3 facts verified.
[macros] Indices in macros don't leak out of scope (#582)
25 facts verified.
[macros] Issue #621
1 fact verified.
[macros] @variables and @constraints
13 facts verified.
[macros] No bare symbols in constraint macros
6 facts verified.
[macros] LB/UB kwargs
6 facts verified.
[fuzzer] Check macros for expression construction
[model] Check error cases
WARNING: Variable value not defined for errVar. Check that the model was properly solved.
6 facts verified.
[model] Performance warnings
WARNING: Variable value not defined for x. Check that the model was properly solved.
WARNING: The addition operator has been used on JuMP expressions a large number of times. This warning is safe to ignore but may indicate that model generation is slower than necessary. For performance reasons, you should not add expressions in a loop. Instead of x += y, use append!(x,y) to modify x in place. If y is a single variable, you may also use push!(x, coef, y) in place of x += coef*y.
0 facts verified.
[model] Test printing a model
Warning, MPS does not support maximization sense. Flipping objective coefficients.
65 facts verified.
[model] Quadratic MPS writer
20 facts verified.
[model] Test solving a MILP
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
20 facts verified.
[model] Test solving an LP (Min)
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
38 facts verified.
[model] Test solving an LP (Max)
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
38 facts verified.
[model] Test binary variable handling
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
4 facts verified.
[model] Test model copying
28 facts verified.
[model] Test variable/model 'hygiene'
> Linear constraint
> Linear objective
> Quadratic constraint
> Affine in quadratic constraint
> Quadratic objective
5 facts verified.
[model] Test NaN checking
3 facts verified.
[model] Test column-wise modeling
9 facts verified.
[model] Test all MPS paths
Warning, MPS does not support maximization sense. Flipping objective coefficients.
0 facts verified.
[model] Test all LP paths
1 fact verified.
[model] Test semi-continuous variables
0 facts verified.
[model] Test semi-integer variables
0 facts verified.
[model] Test fixed variables don't leak through MPB
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
12 facts verified.
WARNING: Ignoring partial starting solution. Cbc requires a feasible value to be specified for all variables.
WARNING: Solver does not appear to support providing initial feasible solutions.
[model] Test SOS constraints
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
Cbc3007W No integer variables - nothing to do
Cbc3007W No integer variables - nothing to do
10 facts verified.
[model] Test vectorized model creation
2 facts verified.
[model] Test MIQP vectorization
0 facts verified.
[model] Test setsolver
11 facts verified.
[model] Setting solve hook
2 facts verified.
[model] Setting print hook
1 fact verified.
[model] Test linearindex
5 facts verified.
[model] Test LinearConstraint from ConstraintRef
1 fact verified.
[model] Test getvalue on OneIndexedArrays
2 facts verified.
[model] Relaxation keyword argument to solve
24 facts verified.
[model] Unrecognized keyword argument to solve
1 fact verified.
[probmod] Testing problem modification basics
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
26 facts verified.
[probmod] Testing problem modification part two
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
WARNING: Solver does not appear to support hot-starts. Model will be built from scratch.
Presolve 0 (-1) rows, 0 (-3) columns and 0 (-3) elements
Optimal - objective value 3.3
After Postsolve, objective 3.3, infeasibilities - dual 0.9999999 (1), primal 0 (0)
Presolved model was optimal, full model needs cleaning up
0 Obj 3.3 Dual inf 0.9999999 (1)
1 Obj 3.3
Optimal - objective value 3.3
Optimal objective 3.3 - 1 iterations time 0.002, Presolve 0.00
Cbc0045I Solution with objective value -3.3 saved
WARNING: Solver does not appear to support adding constraints to an existing model. Hot-start is disabled.
Presolve 0 (-3) rows, 0 (-3) columns and 0 (-7) elements
Optimal - objective value 2.2
After Postsolve, objective 2.2, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective 2.2 - 0 iterations time 0.002, Presolve 0.00
Cbc0045I Solution with objective value -2.2 saved
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
36 facts verified.
[probmod] Test adding a range constraint and modifying it
1 fact verified.
[probmod] Test adding a 'decoupled' variable (#205)
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
Presolve 0 (-3) rows, 0 (-3) columns and 0 (-7) elements
Optimal - objective value 101.1
After Postsolve, objective 101.1, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective 101.1 - 0 iterations time 0.002, Presolve 0.00
Cbc0045I Solution with objective value -101.1 saved
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
4 facts verified.
[probmod] Test JuMP.build
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
16 facts verified.
[probmod] Test JuMP.build with MIP
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
12 facts verified.
[probmod] Test adding empty constraints
> With solver Clp.ClpMathProgSolverInterface.ClpSolver
> With solver GLPKMathProgInterface.GLPKInterfaceLP.GLPKSolverLP
4 facts verified.
[probmod] Test bound modification on binaries
> With solver Cbc.CbcMathProgSolverInterface.CbcSolver
Optimal - objective value 1
Optimal objective 1 - 0 iterations time 0.002
Cbc0045I Solution with objective value -1 saved
Optimal - objective value 0
Optimal objective 0 - 0 iterations time 0.002
Cbc0045I Solution with objective value 0 saved
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
12 facts verified.
[probmod] Applicable regressions
> Clp
> Cbc
> GLPK LP
> GLPK MIP
72 facts verified.
[callback] Test lazy constraints
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
8 facts verified.
[callback] Test user cuts
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
3 facts verified.
[callback] Test heuristics
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
6 facts verified.
[callback] Test informational callback
WARNING: Ignoring infeasible solution from heuristic callback
0 facts verified.
[callback] Callback exit on CallbackAbort
> With solver GLPKMathProgInterface.GLPKInterfaceMIP.GLPKSolverMIP
1 fact verified.
WARNING: Not solved to optimality, status: UserLimit
[qcqpmodel] Test quad objective (discrete)
0 facts verified.
[qcqpmodel] Test quad objective (continuous)
0 facts verified.
[qcqpmodel] Test quad constraints (continuous)
0 facts verified.
[qcqpmodel] Test SOC constraints (continuous)
0 facts verified.
[qcqpmodel] Test SOC duals
0 facts verified.
[qcqpmodel] Test quad constraints (discrete)
0 facts verified.
[qcqpmodel] Test simple normed problem
0 facts verified.
[qcqpmodel] Test quad problem modification
0 facts verified.
[qcqpmodel] Rotated second-order cones
0 facts verified.
WARNING: Quadratic tests not run!
[nonlinear] Test getvalue on arrays
5 facts verified.
[nonlinear] Test HS071 solves correctly
> With solver NLopt.NLoptSolver
3 facts verified.
[nonlinear] Test HS071 solves correctly, epigraph
> With solver NLopt.NLoptSolver
WARNING: Nonlinear solver does not provide dual solutions
2 facts verified.
[nonlinear] Test ifelse
0 facts verified.
[nonlinear] Accepting fixed variables
> With solver NLopt.NLoptSolver, simplify = true
> With solver NLopt.NLoptSolver, simplify = false
8 facts verified.
[nonlinear] Test QP solve through NL pathway
> With solver NLopt.NLoptSolver
8 facts verified.
[nonlinear] Test quad con solve through NL pathway
> With solver NLopt.NLoptSolver
3 facts verified.
[nonlinear] Test resolve with parameter
> With solver NLopt.NLoptSolver, simplify = true
> With solver NLopt.NLoptSolver, simplify = false
8 facts verified.
[nonlinear] Test two-sided nonlinear constraints
> With solver NLopt.NLoptSolver
4 facts verified.
[nonlinear] Quadratic equality constraints
> With solver NLopt.NLoptSolver
WARNING: Not solved to optimality, status: Suboptimal
Failure :: (line:505) :: With solver NLopt.NLoptSolver :: fact was false
Expression: status --> :(:Optimal)
Expected: :Optimal
Occurred: :Suboptimal
Failure :: (line:505) :: With solver NLopt.NLoptSolver :: fact was false
Expression: getvalue(x) --> roughly([sqrt(1 / 2),0],1.0e-6)
Expected: [0.0,0.0] ≅ [0.7071067811865476,0.0]
Out of 2 total facts:
Failed: 2
[nonlinear] Test mixed integer nonlinear problems
0 facts verified.
[nonlinear] Test continuous relaxation of minlp test problem
> With solver NLopt.NLoptSolver
5 facts verified.
[nonlinear] Test maximization objective
> With solver NLopt.NLoptSolver
3 facts verified.
WARNING: in @NLexpression(quadexpr2,x + x ^ 2 + x * y + y ^ 2): three arguments are required.
Note that the syntax of @NLexpression has recently changed:
The first argument should be the model to which the expression is attached.
The second is the name of the expression (or collection of expressions).
The third is the expression itself.
Example:
@NLexpression(m, my_expr, x^2/y)
@NLexpression(m, my_expr_collection[i=1:2], sin(z[i])^2)
Support for the old syntax (with the model omitted) will be removed in an upcoming release.
[nonlinear] Test maximization objective (embedded expressions)
> With solver NLopt.NLoptSolver, simplify = true
WARNING: in @NLexpression(x + x ^ 2 + x * y + y ^ 2): three arguments are required.
Note that the syntax of @NLexpression has recently changed:
The first argument should be the model to which the expression is attached.
The second is the name of the expression (or collection of expressions).
The third is the expression itself.
Example:
@NLexpression(m, my_expr, x^2/y)
@NLexpression(m, my_expr_collection[i=1:2], sin(z[i])^2)
Support for the old syntax (with the model omitted) will be removed in an upcoming release.
> With solver NLopt.NLoptSolver, simplify = false
12 facts verified.
[nonlinear] Test infeasibility detection
0 facts verified.
[nonlinear] Test unboundedness detection
0 facts verified.
[nonlinear] Test entropy maximization
> With solver NLopt.NLoptSolver
2 facts verified.
[nonlinear] Test entropy maximization (reformulation)
> With solver NLopt.NLoptSolver
=================================[ ERROR: Cbc ]=================================
failed process: Process(`/opt/homebrew-cask/Caskroom/julia/0.4.5/Julia-0.4.5.app/Contents/Resources/julia/bin/julia --check-bounds=yes --code-coverage=none --color=no /Users/utensil/.julia/v0.4/Cbc/test/runtests.jl`, ProcessSignaled(9)) [0]
================================================================================
INFO: No packages to install, update or remove
LoadError: Cbc had test errors
while loading In[2], in expression starting on line 1
In [ ]:
Pkg.test("Clp")
INFO: Testing Clp
Testing linprog with solver Clp.ClpMathProgSolverInterface.ClpSolver
WARNING: Element type Int64 does not have an infinite value. Note that this may artifically introduce ranged (two-sided) constraints. To avoid this, consider casting the problem data to Float64.
Passed
In [1]:
using JuMP # Need to say it whenever we use JuMP
using GLPKMathProgInterface # Loading the GLPK module for using its solver
#MODEL CONSTRUCTION
#--------------------
myModel = Model(solver=GLPKSolverLP())
# Name of the model object. All constraints and variables of an optimization problem are associated
# with a particular model object. The name of the model object does not have to be myModel, it can be yourModel too! The argument of Model,
# solver=GLPKsolverLP() means that to solve the optimization problem we will use GLPK solver.
#VARIABLES
#---------
# A variable is modelled using @defVar(name of the model object, variable name and bound, variable type)
# Bound can be lower bound, upper bound or both. If no variable type is defined, then it is treated as
#real. For binary variable write Bin and for integer use Int.
@defVar(myModel, x >= 0) # Models x >=0
# Some possible variations:
# @defVar(myModel, x, Binary) # No bound on x present, but x is a binary variable now
# @defVar(myModel, x <= 10) # This one defines a variable with lower bound x <= 10
# @defVar(myModel, 0 <= x <= 10, Int) # This one has both lower and upper bound, and x is an integer
@defVar(myModel, y >= 0) # Models y >= 0
#OBJECTIVE
#---------
@setObjective(myModel, Min, x + y) # Sets the objective to be minimized. For maximization use Max
#CONSTRAINTS
#-----------
@addConstraint(myModel, x + y <= 1) # Adds the constraint x + y <= 1
#THE MODEL IN A HUMAN-READABLE FORMAT
#------------------------------------
println("The optimization problem to be solved is:")
print(myModel) # Shows the model constructed in a human-readable form
#SOLVE IT AND DISPLAY THE RESULTS
#--------------------------------
status = solve(myModel) # solves the model
println("Objective value: ", getObjectiveValue(myModel)) # getObjectiveValue(model_name) gives the optimum objective value
println("x = ", getValue(x)) # getValue(decision_variable) will give the optimum value of the associated decision variable
println("y = ", getValue(y))
WARNING: @defVar is deprecated, use @variable instead.
WARNING: @setObjective is deprecated, use @objective instead.
WARNING: @addConstraint is deprecated, use @constraint instead.
The optimization problem to be solved is:
Min x + y
Subject to
x + y ≤ 1
x ≥ 0
y ≥ 0
WARNING: getObjectiveValue is deprecated, use getobjectivevalue instead.
Objective value: 0.0
x = 0.0
y = 0.0
in depwarn at deprecated.jl:73
in getObjectiveValue at deprecated.jl:30
in include_string at loading.jl:282
in execute_request_0x535c5df2 at /Users/utensil/.julia/v0.4/IJulia/src/execute_request.jl:182
in eventloop at /Users/utensil/.julia/v0.4/IJulia/src/IJulia.jl:142
in anonymous at task.jl:447
while loading In[1], in expression starting on line 49
WARNING: getValue is deprecated, use getvalue instead.
in depwarn at deprecated.jl:73
in getValue at deprecated.jl:30
in include_string at loading.jl:282
in execute_request_0x535c5df2 at /Users/utensil/.julia/v0.4/IJulia/src/execute_request.jl:182
in eventloop at /Users/utensil/.julia/v0.4/IJulia/src/IJulia.jl:142
in anonymous at task.jl:447
while loading In[1], in expression starting on line 51
In [2]:
using JuMP # Need to say it whenever we use JuMP
using GLPKMathProgInterface # Loading the GLPK module for using its solver
#MODEL CONSTRUCTION
#--------------------
myModel = Model(solver=GLPKSolverLP())
# Name of the model object. All constraints and variables of an optimization problem are associated
# with a particular model object. The name of the model object does not have to be myModel, it can be yourModel too! The argument of Model,
# solver=GLPKsolverLP() means that to solve the optimization problem we will use GLPK solver.
#VARIABLES
#---------
# A variable is modelled using @variable(name of the model object, variable name and bound, variable type)
# Bound can be lower bound, upper bound or both. If no variable type is defined, then it is treated as
#real. For binary variable write Bin and for integer use Int.
@variable(myModel, x >= 0) # Models x >=0
# Some possible variations:
# @variable(myModel, x, Binary) # No bound on x present, but x is a binary variable now
# @variable(myModel, x <= 10) # This one defines a variable with lower bound x <= 10
# @variable(myModel, 0 <= x <= 10, Int) # This one has both lower and upper bound, and x is an integer
@variable(myModel, y >= 0) # Models y >= 0
#OBJECTIVE
#---------
@objective(myModel, Min, x + y) # Sets the objective to be minimized. For maximization use Max
#CONSTRAINTS
#-----------
@constraint(myModel, x + y <= 1) # Adds the constraint x + y <= 1
#THE MODEL IN A HUMAN-READABLE FORMAT
#------------------------------------
println("The optimization problem to be solved is:")
print(myModel) # Shows the model constructed in a human-readable form
#SOLVE IT AND DISPLAY THE RESULTS
#--------------------------------
status = solve(myModel) # solves the model
println("Objective value: ", getobjectivevalue(myModel)) # getobjectivevalue(model_name) gives the optimum objective value
println("x = ", getvalue(x)) # getvalue(decision_variable) will give the optimum value of the associated decision variable
println("y = ", getvalue(y))
The optimization problem to be solved is:
Min x + y
Subject to
x + y ≤ 1
x ≥ 0
y ≥ 0
Objective value: 0.0
x = 0.0
y = 0.0
In [1]:
Pkg.add("ECOS")
INFO: Installing ECOS v0.6.2
INFO: Building Homebrew
From https://github.com/Homebrew/homebrew
53c5089..21ce7a5 master -> origin/master
HEAD is now at 21ce7a5 README: clarify and improve human parseability (#50664)
HEAD is now at c377b50 Merge pull request #92 from staticfloat/staging
INFO: Building ECOS
INFO: Package database updated
INFO: METADATA is out-of-date — you may not have the latest version of ECOS
INFO: Use `Pkg.update()` to get the latest versions of your packages
In [4]:
using JuMP
using ECOS
items = [:Gold, :Silver, :Bronze]
values = Dict(:Gold => 5.0, :Silver => 3.0, :Bronze => 1.0)
weight = Dict(:Gold => 2.0, :Silver => 1.5, :Bronze => 0.3)
m = Model(solver=ECOSSolver())
@variable(m, 0 <= take[items] <= 1) # Define a variable for each item
@objective(m, Max, sum{ values[item] * take[item], item in items})
@constraint(m, sum{ weight[item] * take[item], item in items} <= 3)
solve(m)
println(getvalue(take))
take: 1 dimensions:
[ Gold] = 0.9999999995823805
[Silver] = 0.46666666721774464
[Bronze] = 0.9999999995191614
ECOS 2.0.4 - (C) embotech GmbH, Zurich Switzerland, 2012-15. Web: www.embotech.com/ECOS
It pcost dcost gap pres dres k/t mu step sigma IR | BT
0 -5.808e+00 -1.695e+01 +8e+00 5e-03 3e-01 1e+00 1e+00 --- --- 1 1 - | - -
1 -7.021e+00 -8.183e+00 +9e-01 4e-04 4e-02 8e-02 1e-01 0.8975 1e-02 0 0 0 | 0 0
2 -7.342e+00 -7.486e+00 +1e-01 5e-05 5e-03 1e-02 2e-02 0.9055 3e-02 0 0 0 | 0 0
3 -7.399e+00 -7.401e+00 +2e-03 7e-07 6e-05 2e-04 2e-04 0.9867 6e-04 0 0 0 | 0 0
4 -7.400e+00 -7.400e+00 +2e-05 7e-09 7e-07 2e-06 2e-06 0.9890 1e-04 1 0 0 | 0 0
5 -7.400e+00 -7.400e+00 +2e-07 8e-11 8e-09 2e-08 3e-08 0.9890 1e-04 1 0 0 | 0 0
6 -7.400e+00 -7.400e+00 +2e-09 9e-13 9e-11 2e-10 3e-10 0.9890 1e-04 1 0 0 | 0 0
OPTIMAL (within feastol=8.6e-11, reltol=2.8e-10, abstol=2.1e-09).
Runtime: 0.000078 seconds.
In [ ]:
Content source: utensil/julia-playground
Similar notebooks: