Skip to content

Commit

Permalink
Update Project.toml and using's for registration (#263)
Browse files Browse the repository at this point in the history
* Update Project.toml and using's for registration

* Bump JuMP version
  • Loading branch information
odow authored Oct 10, 2019
1 parent a62c041 commit 951c5bf
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ jobs:
julia: 1.0
os: linux
script:
- julia --project=docs -e 'using Pkg; Pkg.instantiate(); Pkg.add(PackageSpec(path=pwd()))'
- julia --project=docs -e 'using Pkg; Pkg.add(PackageSpec(path=pwd()))'
- julia --project=docs --color=yes docs/make.jl
8 changes: 3 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
name = "SDDP"
uuid = "f4570300-c277-11e8-125c-4912f86ce65d"
authors = ["Oscar Dowson <[email protected]"]
version = "0.0.0"
version = "0.1.0"

[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
GLPK = "60bf3e95-4087-53dc-ae20-288a0d20c6a6"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
MathOptFormat = "f4570300-c277-12e8-125c-4912f86ce65d"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand All @@ -20,6 +17,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"

[compat]
JuMP = "~0.20"
julia = "1.0"

[extras]
Expand All @@ -28,4 +26,4 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["GLPK"]
test = ["GLPK", "Test"]
2 changes: 0 additions & 2 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
GLPK = "60bf3e95-4087-53dc-ae20-288a0d20c6a6"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
MathOptFormat = "f4570300-c277-12e8-125c-4912f86ce65d"
9 changes: 8 additions & 1 deletion src/SDDP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ module SDDP
import Reexport
Reexport.@reexport using JuMP

import HTTP, JSON, MathOptFormat, Printf, Random, TimerOutputs, Statistics
import HTTP
import JSON
import LinearAlgebra
import MathOptFormat
import Printf
import Random
import Statistics
import TimerOutputs

# Work-around for https://github.com/JuliaPlots/RecipesBase.jl/pull/55
# Change this back to `import RecipesBase` once the fix is tagged.
Expand Down
8 changes: 3 additions & 5 deletions src/plugins/integrality_handlers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import LinearAlgebra.dot

# ========================= General methods ================================== #

"""
Expand Down Expand Up @@ -235,7 +233,7 @@ function _solve_primal!(subgradients::Vector{Float64}, node::Node, dual_vars::Ve
old_obj = JuMP.objective_function(model)
# Set the Lagrangian the objective in the primal model
fact = (JuMP.objective_sense(model) == JuMP.MOI.MIN_SENSE ? 1 : -1)
new_obj = old_obj + fact * dot(dual_vars, slacks)
new_obj = old_obj + fact * LinearAlgebra.dot(dual_vars, slacks)
JuMP.set_objective_function(model, new_obj)
JuMP.optimize!(model)
lagrangian_obj = JuMP.objective_value(model)
Expand Down Expand Up @@ -297,13 +295,13 @@ function _kelley(node::Node, dual_vars::Vector{Float64}, integrality_handler::SD

# Update the model and update best function value so far
if dualsense == MOI.MIN_SENSE
JuMP.@constraint(approx_model, θ >= f_actual + dot(subgradients, x - dual_vars))
JuMP.@constraint(approx_model, θ >= f_actual + LinearAlgebra.dot(subgradients, x - dual_vars))
if f_actual <= best_actual
best_actual = f_actual
best_mult .= dual_vars
end
else
JuMP.@constraint(approx_model, θ <= f_actual + dot(subgradients, x - dual_vars))
JuMP.@constraint(approx_model, θ <= f_actual + LinearAlgebra.dot(subgradients, x - dual_vars))
if f_actual >= best_actual
best_actual = f_actual
best_mult .= dual_vars
Expand Down
4 changes: 3 additions & 1 deletion test/algorithm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

using SDDP, Test, GLPK
using GLPK
using SDDP
using Test

@testset "Forward Pass" begin
model = SDDP.PolicyGraph(SDDP.LinearGraph(2);
Expand Down
4 changes: 3 additions & 1 deletion test/deterministic_equivalent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

using SDDP, Test, GLPK
using GLPK
using SDDP
using Test

@testset "cyclic checks" begin
@testset "Acyclic linear" begin
Expand Down
3 changes: 2 additions & 1 deletion test/plugins/backward_sampling_schemes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

using SDDP, Test
using SDDP
using Test

@testset "CompleteSampler" begin
model = SDDP.LinearPolicyGraph(
Expand Down
4 changes: 3 additions & 1 deletion test/plugins/bellman_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

using SDDP, Test, GLPK
using GLPK
using SDDP
using Test

@testset "Read/write cuts to file" begin
function create_model(graph)
Expand Down
6 changes: 4 additions & 2 deletions test/plugins/integrality_handlers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

using SDDP, JuMP, GLPK, Test
using GLPK
using SDDP
using Test

@testset "get_dual_variables" begin
# Single-stage model helps set up a node and subproblem to test dual
Expand All @@ -30,7 +32,7 @@ using SDDP, JuMP, GLPK, Test
if integrality_handler == SDDP.ContinuousRelaxation()
SDDP.relax_integrality(model, integrality_handler)
end
JuMP.optimize!(node.subproblem)
optimize!(node.subproblem)
dual_vars = SDDP.get_dual_variables(node, integrality_handler)

if integrality_handler == SDDP.ContinuousRelaxation()
Expand Down
6 changes: 3 additions & 3 deletions test/plugins/risk_measures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

using SDDP, Test

using GLPK # Required for Wasserstein.
using GLPK
using SDDP
using Test

@testset "Expectation" begin
@test sprint(show, SDDP.Expectation()) == "SDDP.Expectation()"
Expand Down
3 changes: 2 additions & 1 deletion test/plugins/sampling_schemes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

using SDDP, Test
using SDDP
using Test

@testset "InSampleMonteCarlo" begin
@testset "Acyclic" begin
Expand Down
5 changes: 4 additions & 1 deletion test/plugins/stopping_rules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.

using SDDP, GLPK, Random, Test
using GLPK
using Random
using SDDP
using Test

@testset "TimeLimit" begin
graph = SDDP.PolicyGraph(SDDP.LinearGraph(2),
Expand Down
4 changes: 3 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

using SDDP, Test, Random
using Random
using SDDP
using Test

function read_dir(dir, exclude = String[])
return filter(s->!(s in exclude) && endswith(s, ".jl"), readdir(dir))
Expand Down
4 changes: 3 additions & 1 deletion test/user_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

using SDDP, Test, GLPK
using GLPK
using SDDP
using Test

@testset "Basic Graphs" begin
@testset "LinearGraph" begin
Expand Down
3 changes: 2 additions & 1 deletion test/visualization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

using SDDP, Test
using SDDP
using Test

@testset "SpaghettiPlot" begin
simulations = [
Expand Down

2 comments on commit 951c5bf

@odow
Copy link
Owner Author

@odow odow commented on 951c5bf Oct 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/4247

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" 951c5bf0ebc149c42465d37baee0189a84278c73
git push origin v0.1.0

Please sign in to comment.