From 6a56b4df7796f0f916daef6696c679393e9b0164 Mon Sep 17 00:00:00 2001 From: Hector Perez Date: Fri, 13 Oct 2023 15:02:19 -0400 Subject: [PATCH 1/2] remove using JuMP. remove jldoctests --- README.md | 1 - docs/Project.toml | 2 +- docs/make.jl | 13 +++++++------ examples/ex1.jl | 1 - examples/ex2.jl | 1 - examples/ex3.jl | 1 - examples/ex4.jl | 1 - examples/ex5.jl | 2 -- examples/ex6.jl | 1 - src/constraints.jl | 9 +++++---- src/macros.jl | 28 +++++++++++----------------- test/runtests.jl | 1 - 12 files changed, 24 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 55bca53..f86511a 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,6 @@ Prior to `v0.4.0`, the package did not leverage the JuMP extension capabilities The example below is from the [Cornell University Computational Optimization Open Textbook](https://optimization.cbe.cornell.edu/index.php?title=Disjunctive_inequalities#Big-M_Reformulation[1][2]). ```julia -using JuMP using DisjunctiveProgramming m = GDPModel() diff --git a/docs/Project.toml b/docs/Project.toml index dfa65cd..1b16efe 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,2 +1,2 @@ [deps] -Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +DisjunctiveProgramming = "0d27d021-0159-4c7d-b4a7-9ccb5d9366cf" diff --git a/docs/make.jl b/docs/make.jl index 6823b31..627842f 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,12 +1,13 @@ -push!(LOAD_PATH,"../src/") using DisjunctiveProgramming using Documenter makedocs( - sitename = "DisjunctiveProgramming.jl", - modules = [DisjunctiveProgramming], - pages=[ - "Home" => "index.md" - ]) + sitename = "DisjunctiveProgramming.jl", + modules = [DisjunctiveProgramming], + pages=[ + "Home" => "index.md" + ], + checkdocs = :none +) deploydocs(; repo="github.com/hdavid16/DisjunctiveProgramming.jl", ) diff --git a/examples/ex1.jl b/examples/ex1.jl index b6810d7..e92344c 100644 --- a/examples/ex1.jl +++ b/examples/ex1.jl @@ -1,4 +1,3 @@ -using JuMP using DisjunctiveProgramming using HiGHS diff --git a/examples/ex2.jl b/examples/ex2.jl index d23a540..c023525 100644 --- a/examples/ex2.jl +++ b/examples/ex2.jl @@ -1,5 +1,4 @@ # https://optimization.cbe.cornell.edu/index.php?title=Disjunctive_inequalities#Big-M_Reformulation[1][2] -using JuMP using DisjunctiveProgramming using HiGHS diff --git a/examples/ex3.jl b/examples/ex3.jl index 39481be..c429e9d 100644 --- a/examples/ex3.jl +++ b/examples/ex3.jl @@ -1,4 +1,3 @@ -using JuMP using DisjunctiveProgramming m = GDPModel() diff --git a/examples/ex4.jl b/examples/ex4.jl index 77ec314..b7bdb21 100644 --- a/examples/ex4.jl +++ b/examples/ex4.jl @@ -1,4 +1,3 @@ -using JuMP using DisjunctiveProgramming # Example with proposition reformulation diff --git a/examples/ex5.jl b/examples/ex5.jl index 20b5549..52cb002 100644 --- a/examples/ex5.jl +++ b/examples/ex5.jl @@ -1,6 +1,4 @@ # https://arxiv.org/pdf/2303.04375.pdf - -using JuMP using DisjunctiveProgramming ## diff --git a/examples/ex6.jl b/examples/ex6.jl index 0fb3ea2..0f9f89a 100644 --- a/examples/ex6.jl +++ b/examples/ex6.jl @@ -1,4 +1,3 @@ -using JuMP using DisjunctiveProgramming ## diff --git a/src/constraints.jl b/src/constraints.jl index 1c8941f..4bc41d3 100644 --- a/src/constraints.jl +++ b/src/constraints.jl @@ -417,10 +417,11 @@ cardinality sets: `AtLeast(n)`, `AtMost(n)`, or `Exactly(n)`. To select exactly 1 logical variable `Y` to be `true`, do (the same can be done with `AtLeast(n)` and `AtMost(n)`): -```jldoctest -julia> model = GDPModel(); -julia> @variable(model, Y[i = 1:2], LogicalVariable); -julia> @constraint(model, [Y[1], Y[2]] in Exactly(1)); +```julia +using DisjunctiveProgramming +model = GDPModel(); +@variable(model, Y[i = 1:2], LogicalVariable); +@constraint(model, [Y[1], Y[2]] in Exactly(1)); ``` JuMP.build_constraint( diff --git a/src/macros.jl b/src/macros.jl index 1ea2aff..9565508 100644 --- a/src/macros.jl +++ b/src/macros.jl @@ -285,23 +285,17 @@ The macro returns a tuple containing the disjunctions that were defined. ## Example -```jldoctest -julia> model = GDPModel(); - -julia> @variable(model, w); - -julia> @variable(model, x); - -julia> @variable(model, Y[1:4], LogicalVariable); - -julia> @constraint(model, [i=1:2], w == i, DisjunctConstraint(Y[i])); - -julia> @constraint(model, [i=3:4], x == i, DisjunctConstraint(Y[i])); - -julia> @disjunctions(model, begin - [Y[1], Y[2]] - [Y[3], Y[4]] - end); +```julia +model = GDPModel(); +@variable(model, w); +@variable(model, x); +@variable(model, Y[1:4], LogicalVariable); +@constraint(model, [i=1:2], w == i, DisjunctConstraint(Y[i])); +@constraint(model, [i=3:4], x == i, DisjunctConstraint(Y[i])); +@disjunctions(model, begin + [Y[1], Y[2]] + [Y[3], Y[4]] +end); ```` """ macro disjunctions(m, x) diff --git a/test/runtests.jl b/test/runtests.jl index e06b246..b443d68 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,4 @@ using DisjunctiveProgramming -using JuMP using Test const DP = DisjunctiveProgramming From 61e352e7f6112577781a0810dd90f695cc311779 Mon Sep 17 00:00:00 2001 From: Hector Perez Date: Fri, 13 Oct 2023 15:04:32 -0400 Subject: [PATCH 2/2] add documenter to project.toml --- docs/Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Project.toml b/docs/Project.toml index 1b16efe..ef99e1a 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,2 +1,3 @@ [deps] DisjunctiveProgramming = "0d27d021-0159-4c7d-b4a7-9ccb5d9366cf" +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"