From c27c68fcc1217f0e3ca196dedd05a0fdd115af84 Mon Sep 17 00:00:00 2001 From: Joshua Pulsipher Date: Thu, 4 Apr 2019 11:41:06 -0500 Subject: [PATCH] Updated files for julia 1.0 --- README.md | 7 ++++--- appveyor.yml | 39 ++++++++++++++------------------------- docs/REQUIRE | 2 +- docs/make.jl | 11 ++++------- docs/src/api.md | 1 + docs/src/guide.md | 13 +++++++++++++ docs/src/index.md | 7 ++++--- src/solve.jl | 2 +- test/solvehook_checks.jl | 4 ++-- 9 files changed, 44 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 39bfae8..447c238 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ FlexJuMP.jl is not yet a registered Julia package, but can still be installed by with the url of the repository instead of the name. ```julia -Pkg.clone("git://github.com/pulsipher/FlexJuMP.jl.git") +using Pkg +Pkg.add("git://github.com/pulsipher/FlexJuMP.jl.git") ``` ## Documentation @@ -28,9 +29,9 @@ an API library. ## Project Status -The package is tested against Julia `0.6` on Linux, macOS, and Windows. +The package is tested against Julia `0.7`, `1.0`, and `1.1` on Linux, macOS, and Windows. -There is not yet support for Julia `0.7` or `1.0`. +A working version for Julia `0.6` can be found in julia-0.6 branch. ## Contributing FlexJuMP is being actively developed and suggestions or other forms of contribution are encouraged. diff --git a/appveyor.yml b/appveyor.yml index d4095f8..a7ffc8e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,16 +1,17 @@ environment: matrix: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" + - julia_version: 1.0 + - julia_version: 1.1 + +platform: + - x86 # 32-bit + - x64 # 64-bit ## uncomment the following lines to allow failures on nightly julia ## (tests will run but not make your overall status red) -matrix: - allow_failures: - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" +# matrix: +# allow_failures: +# - julia_version: latest branches: only: @@ -30,24 +31,12 @@ notifications: on_build_status_changed: false install: - - ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12" -# If there's a newer build queued for the same PR, cancel this one - - ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` - https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` - Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` - throw "There are newer queued builds for this pull request, failing early." } -# Download most recent Julia Windows binary - - ps: (new-object net.webclient).DownloadFile( - $env:JULIA_URL, - "C:\projects\julia-binary.exe") -# Run installer silently, output to C:\projects\julia - - C:\projects\julia-binary.exe /S /D=C:\projects\julia + - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1")) build_script: -# Need to convert from shallow to complete for Pkg.clone to work - - IF EXIST .git\shallow (git fetch --unshallow) - - C:\projects\julia\bin\julia -e "versioninfo(); - Pkg.clone(pwd(), \"FlexJuMP\"); Pkg.build(\"FlexJuMP\")" + - echo "%JL_BUILD_SCRIPT%" + - C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%" test_script: - - C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"FlexJuMP\")" + - echo "%JL_TEST_SCRIPT%" + - C:\julia\bin\julia -e "%JL_TEST_SCRIPT%" diff --git a/docs/REQUIRE b/docs/REQUIRE index 6bd66c8..0f2f954 100644 --- a/docs/REQUIRE +++ b/docs/REQUIRE @@ -1 +1 @@ -Documenter 0.19.6 \ No newline at end of file +Documenter diff --git a/docs/make.jl b/docs/make.jl index 2e82caf..44107b1 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,8 +1,9 @@ using Documenter, FlexJuMP makedocs(modules = [FlexJuMP], - format = :html, - sitename = "FlexJuMP.jl", + doctest=true,html_prettyurls = get(ENV, "CI", nothing) == "true" + sitename = "FlexJuMP.jl - A Framework for Flexibility Analysis", + authors = "Joshua Pulsipher", pages = ["Home" => "index.md", "Background" => "background.md", "User Guide" => "guide.md", @@ -10,9 +11,5 @@ makedocs(modules = [FlexJuMP], "Library" => "api.md"]) deploydocs( - repo = "github.com/pulsipher/FlexJuMP.jl.git", - target = "build", - julia = "0.6", - deps = nothing, - make = nothing + repo = "github.com/pulsipher/FlexJuMP.jl.git" ) diff --git a/docs/src/api.md b/docs/src/api.md index 96474e7..25a0938 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -27,6 +27,7 @@ ismeanfeasible findcenteredmean getflexibilityindex getconfidencelevel +getsolutiontime getactiveconstraints JuMP.getvalue(v::FlexibilityVariable) rankinequalities diff --git a/docs/src/guide.md b/docs/src/guide.md index 5869050..3374947 100644 --- a/docs/src/guide.md +++ b/docs/src/guide.md @@ -371,6 +371,19 @@ data = getflexibilitydata(m) FlexJuMP.FlexibilityData(JuMP.AbstractConstraint[-0.67*Qc + 2*T[2] + x - 100 <= 0, -1*T[2] + -x - 250 == 0, 0.5*Qc + -0.75*T[1] + -1*T[2] + -1*T[3] + 1388.5 <= 0, -1*Qc + 1.5*T[1] + 2*T[2] + 1*T[3] + -2044 >= 0, 1*Qc + -1.5*T[1] + -2*T[2] + -1*T[3] + -2*T[4] + 2830 <= 0, -1*Qc + 1.5*T[1] + 2*T[2] + 1*T[3] + 3*T[4] + -3153 <= 0], 4, Number[620, 388, 583, 313], AbstractString["T[1]", "T[2]", "T[3]", "T[4]"], [1, 2, 3, 4], 1, AbstractString["Qc"], [5], FlexJuMP.EllipsoidalSet(:Ellipsoid, false), Number[11.11 0.0 0.0 0.0; 0.0 11.11 0.0 0.0; 0.0 0.0 11.11 0.0; 0.0 0.0 0.0 11.11], 3.600355086286672, [3, 6]) ``` +### Solution Time Extraction +The optimal solution time stored in `m` can be extracted using the +[`getsolutiontime`](@ref) method. This is extracted from the if it is supported, +otherwise it is determined using the `@elapsed` macro. With the current example we +have: + +```julia +opt_time = getsolutiontime(m) +``` +```julia +0.0034827596723466 +``` + ## Analysis Methods ### Ranking Limiting Constraints diff --git a/docs/src/index.md b/docs/src/index.md index d470698..9bac954 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -30,10 +30,11 @@ FlexJuMP.jl is not yet a registered Julia package, but can still be installed by with the url of the repository instead of the name. ```julia -Pkg.clone("git://github.com/pulsipher/FlexJuMP.jl.git") +using Pkg +Pkg.add("git://github.com/pulsipher/FlexJuMP.jl.git") ``` -Also, FlexJuMP.jl only supports Julia 0.6, but soon will be compatible with Julia 0.7 and -Julia 1.0. +The latest version of FlexJuMP.jl now only supports Julia 0.7 and above. A version is still available for use +with Julia 0.6 under the julia-0.6 branch. ## Quick Start Below is a brief example of the high-level API, more explanation and examples are provided in [User Guide](@ref) and [Examples](@ref). diff --git a/src/solve.jl b/src/solve.jl index 34fe072..1988b00 100644 --- a/src/solve.jl +++ b/src/solve.jl @@ -238,7 +238,7 @@ function solvehook(m::Model; suppress_warnings::Bool = false, U::Number = 10000, end # Parse the active active constraints - active_inds = findall(abs.(getvalue(y) - 1) .<= 1e-4) + active_inds = findall(abs.(getvalue(y) - ones(n_f)) .<= 1e-4) flex_data.active_constraints = inequal_inds[active_inds] # Save the flexibility index diff --git a/test/solvehook_checks.jl b/test/solvehook_checks.jl index 2dc787a..8eb569a 100644 --- a/test/solvehook_checks.jl +++ b/test/solvehook_checks.jl @@ -1,10 +1,10 @@ # Test the solvehook's options -# @test_logs (:warn, "Problem requires use of active set constraint. Setting active_constr = true") solve(m) == :Optimal +@test_logs (:warn, "Problem requires use of active set constraint. Setting active_constr = true") solve(m) == :Optimal @test solve(m, active_constr = true) == :Optimal && abs(getflexibilityindex(m) - 3.6) <= 1e-2 @test solve(m, active_constr = true, diag = true) == :Optimal && abs(getflexibilityindex(m) - 3.6) <= 1e-2 @test solve(m, active_constr = true, conic_δ = true) == :Optimal && abs(getflexibilityindex(m) - 3.6) <= 1e-2 @test solve(m, active_constr = true) == :Optimal && abs(getflexibilityindex(m) - 3.6) <= 1e-2 -# @test_logs (:warn, "The slack upper bound (U)") solve(m, active_constr = true, U = 1000) == :Optimal +@test_logs (:warn, "The slack upper bound (U) value of 1000 is too low for this problem. Thus, U is being set to 10000.0 !") solve(m, active_constr = true, U = 1000) == :Optimal # Test with other uncertainty sets dev = ones(flex_data.numRVs) * 10