Skip to content

Commit

Permalink
Merge pull request #15 from kibaekkim/patch/StructJuMP
Browse files Browse the repository at this point in the history
updated StructJuMP to v0.2.0
  • Loading branch information
kibaekkim authored Jun 30, 2020
2 parents 98ad96b + 1f3bc07 commit 93e148c
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 47 deletions.
57 changes: 32 additions & 25 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
version = "0.7.0"

[[CommonSubexpressions]]
deps = ["Test"]
git-tree-sha1 = "efdaf19ab11c7889334ca247ff4c9f7c322817b0"
deps = ["MacroTools", "Test"]
git-tree-sha1 = "7b8a93dba8af7e3b42fecabf646260105ac373f7"
uuid = "bbf7d656-a473-5ed7-a52c-81e309532950"
version = "0.2.0"
version = "0.3.0"

[[CompilerSupportLibraries_jll]]
deps = ["Libdl", "Pkg"]
Expand All @@ -47,9 +47,9 @@ version = "0.3.3+0"

[[DataStructures]]
deps = ["InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "be680f1ad03c0a03796aa3fda5a2180df7f83b46"
git-tree-sha1 = "edad9434967fdc0a2631a65d902228400642120c"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.17.18"
version = "0.17.19"

[[Dates]]
deps = ["Printf"]
Expand Down Expand Up @@ -79,9 +79,9 @@ version = "0.8.2"

[[ForwardDiff]]
deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "NaNMath", "Random", "SpecialFunctions", "StaticArrays"]
git-tree-sha1 = "869540e4367122fbffaace383a5bdc34d6e5e5ac"
git-tree-sha1 = "48ff21740dfadb05eb1233c9fe17c2ad9cde4d45"
uuid = "f6369f11-7733-5829-9624-2563aa707210"
version = "0.10.10"
version = "0.10.11"

[[HTTP]]
deps = ["Base64", "Dates", "IniFile", "MbedTLS", "Sockets"]
Expand Down Expand Up @@ -112,12 +112,13 @@ uuid = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
version = "0.3.0"

[[JuMP]]
deps = ["Calculus", "DataStructures", "ForwardDiff", "LinearAlgebra", "MathOptInterface", "NaNMath", "Random", "SparseArrays", "Statistics"]
git-tree-sha1 = "ba7f96010ed290d77d5c941c32e5df107ca688a4"
deps = ["Calculus", "DataStructures", "ForwardDiff", "LinearAlgebra", "MathOptInterface", "MutableArithmetics", "NaNMath", "Random", "SparseArrays", "Statistics"]
git-tree-sha1 = "cbab42e2e912109d27046aa88f02a283a9abac7c"
uuid = "4076af6c-e467-56ae-b986-b466b2749572"
version = "0.20.1"
version = "0.21.3"

[[LibGit2]]
deps = ["Printf"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"

[[Libdl]]
Expand All @@ -142,6 +143,12 @@ git-tree-sha1 = "4d37f1e07b4e2a74462eebf9ee48c626d15ffdac"
uuid = "7cb0a576-ebde-5e09-9194-50597f1243b4"
version = "3.3.2+10"

[[MacroTools]]
deps = ["Markdown", "Random"]
git-tree-sha1 = "f7d2e3f654af75f01ec49be82c231c382214223a"
uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
version = "0.5.5"

[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
Expand All @@ -160,9 +167,9 @@ version = "1.0.2"

[[MbedTLS_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "c83f5a1d038f034ad0549f9ee4d5fac3fb429e33"
git-tree-sha1 = "f85473aeb7a2561a5c58c06c4868971ebe2bcbff"
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.16.0+2"
version = "2.16.6+0"

[[MicrosoftMPI_jll]]
deps = ["Libdl", "Pkg"]
Expand All @@ -175,9 +182,9 @@ uuid = "a63ad114-7e13-5084-954f-fe012c677804"

[[MutableArithmetics]]
deps = ["LinearAlgebra", "SparseArrays", "Test"]
git-tree-sha1 = "e1edd618a8f39d16f8595dd622a63b25f759cf8a"
git-tree-sha1 = "6cf09794783b9de2e662c4e8b60d743021e338d0"
uuid = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"
version = "0.2.9"
version = "0.2.10"

[[NaNMath]]
git-tree-sha1 = "928b8ca9b2791081dc71a51c55347c27c618760f"
Expand All @@ -202,19 +209,19 @@ uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.2.0"

[[ParameterJuMP]]
deps = ["JuMP", "MathOptInterface", "SparseArrays"]
git-tree-sha1 = "061bbb1cfaed57f3a65c5e688285f8da9bef0178"
deps = ["JuMP", "MathOptInterface", "MutableArithmetics", "SparseArrays"]
git-tree-sha1 = "5e4871fd77f020af394f876d2de82bc4fc979485"
uuid = "774612a8-9878-5177-865a-ca53ae2495f9"
version = "0.1.2"
version = "0.2.0"

[[Parsers]]
deps = ["Dates", "Test"]
git-tree-sha1 = "eb3e09940c0d7ae01b01d9291ebad7b081c844d3"
git-tree-sha1 = "20ef902ea02f7000756a4bc19f7b9c24867c6211"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "1.0.5"
version = "1.0.6"

[[Pkg]]
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Test", "UUIDs"]
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[[Printf]]
Expand Down Expand Up @@ -266,11 +273,11 @@ uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[[StructJuMP]]
deps = ["JuMP", "LinearAlgebra", "MathOptInterface", "ParameterJuMP"]
git-tree-sha1 = "1b2e6d224a6211785deabfabaa347bffc43926ad"
repo-rev = "kibaekkim-patch-1"
git-tree-sha1 = "f5166e0f6b1e6ae53cf8afb111838a1785e8c22b"
repo-rev = "v0.2.0"
repo-url = "https://github.com/StructJuMP/StructJuMP.jl.git"
uuid = "34f15cae-5318-50c9-93d3-9feadd34e321"
version = "0.1.0"
version = "0.2.0"

[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
Expand All @@ -297,6 +304,6 @@ version = "0.9.2"

[[Zlib_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "a2e0d558f6031002e380a90613b199e37a8565bf"
git-tree-sha1 = "622d8b6dc0c7e8029f17127703de9819134d1b71"
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
version = "1.2.11+10"
version = "1.2.11+14"
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StructJuMP = "34f15cae-5318-50c9-93d3-9feadd34e321"

[compat]
JuMP = "0.20.1"
JuMP = "0.21.3"
MPI = "0.14.3"
MathOptInterface = "0.9.14"
StructJuMP = "0.1.0"
StructJuMP = "0.2.0"
julia = "^1.3"

[extras]
Expand Down
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# DSP.jl
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/kibaekkim/DSP.jl?label=release&sort=semver)
[![Build Status](https://travis-ci.org/kibaekkim/DSP.jl.svg?branch=master)](https://travis-ci.org/kibaekkim/DSP.jl)
[![codecov](https://codecov.io/gh/kibaekkim/Dsp.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/kibaekkim/Dsp.jl)

Expand All @@ -10,13 +11,8 @@ and solve the block-structured problem using the parallle solver ``DSP``.

> **_NOTE:_** You need to install solver [DSP](https://github.com/Argonne-National-Laboratory/DSP) first. This package provides an interface only.
Due to the dependency on `StructJuMP.jl`, we recommend to instantiate the package with `Manifest.toml`.
To do so, please `clone` and `instantiate` the repo.

```
git clone git@github.com:kibaekkim/DSP.jl.git
cd DSP.jl
julia --project=. -e 'using Pkg; Pkg.instantiate()'
```julia
] add https://github.com/kibaekkim/DSP.jl.git
```

## Examples
Expand Down
31 changes: 18 additions & 13 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ end
end
end

"""
NOTE:
JuMP v0.21 changes the order of indexing variables.
This affects some of the test lines below, which were based on the older variable indexing.
"""

@testset "Farmer example: block form" begin
include("farmer_block.jl")
@testset "Parent model" begin
Expand All @@ -128,21 +134,20 @@ end
@test length(start) == length(m.constraints) + 1
@test start[end] == length(index)
@test start == [0, 2, 4, 6, 8, 10, 12]
# NOTE: The order of variable indices has been changed in JuMP v0.21. Some tests fail.
@test index == [0, 1, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8] # will fail with JuMP v0.21
# @test index == [0, 1, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8] # will fail with JuMP v0.21
@test value == [1., -1., 1., -1., 1., -1., 1., -1., 1., -1., 1., -1.]
@test rlbd == zeros(6)
@test rubd == zeros(6)
@test obj == [
probability[1]*Cost[1], probability[2]*Cost[1], probability[3]*Cost[1],
probability[1]*Cost[2], probability[2]*Cost[2], probability[3]*Cost[2],
probability[1]*Cost[3], probability[2]*Cost[3], probability[3]*Cost[3],
probability[1]*Purchase[1], probability[2]*Purchase[1], probability[3]*Purchase[1],
probability[1]*Purchase[2], probability[2]*Purchase[2], probability[3]*Purchase[2],
-probability[1]*Sell[1], -probability[2]*Sell[1], -probability[3]*Sell[1],
-probability[1]*Sell[2], -probability[2]*Sell[2], -probability[3]*Sell[2],
-probability[1]*Sell[3], -probability[2]*Sell[3], -probability[3]*Sell[3],
-probability[1]*Sell[4], -probability[2]*Sell[4], -probability[3]*Sell[4]] # will fail with JuMP v0.21
# @test obj == [
# probability[1]*Cost[1], probability[2]*Cost[1], probability[3]*Cost[1],
# probability[1]*Cost[2], probability[2]*Cost[2], probability[3]*Cost[2],
# probability[1]*Cost[3], probability[2]*Cost[3], probability[3]*Cost[3],
# probability[1]*Purchase[1], probability[2]*Purchase[1], probability[3]*Purchase[1],
# probability[1]*Purchase[2], probability[2]*Purchase[2], probability[3]*Purchase[2],
# -probability[1]*Sell[1], -probability[2]*Sell[1], -probability[3]*Sell[1],
# -probability[1]*Sell[2], -probability[2]*Sell[2], -probability[3]*Sell[2],
# -probability[1]*Sell[3], -probability[2]*Sell[3], -probability[3]*Sell[3],
# -probability[1]*Sell[4], -probability[2]*Sell[4], -probability[3]*Sell[4]] # will fail with JuMP v0.21
@test clbd == zeros(27)
@test cubd == zeros(27) .+ Inf
@test ctype == "IIIIIIIIICCCCCCCCCCCCCCCCCC"
Expand All @@ -155,7 +160,7 @@ end
@test length(start) == length(subm.constraints) + 1
@test start[end] == length(index)
@test start == [0, 3, 6, 9, 12, 13]
@test index == [0, 3, 6, 0, 9, 15, 3, 12, 18, 6, 21, 24, 21] .+ (i-1) # will fail with JuMP v0.21
# @test index == [0, 3, 6, 0, 9, 15, 3, 12, 18, 6, 21, 24, 21] .+ (i-1) # will fail with JuMP v0.21
@test value == [1., 1., 1., Yield[i,1], 1., -1., Yield[i,2], 1., -1., Yield[i,3], -1., -1., 1.]
@test rlbd == [-Inf; Minreq; -Inf]
@test rubd == [Budget, Inf, Inf, Inf, 6000]
Expand Down

0 comments on commit 93e148c

Please sign in to comment.