From 3d1953f92bd1fad755fc934ddc5e4b6dcabbe829 Mon Sep 17 00:00:00 2001 From: Itamar Rocha Date: Mon, 1 Mar 2021 08:29:15 -0300 Subject: [PATCH 1/3] fixing typos and removing discord chat link (#456) --- docs/src/index.md | 18 +++++++++--------- docs/src/user/callbacks.md | 14 +++++++------- docs/src/user/start.md | 10 +++++----- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index 0c671541e..e1b54a362 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,13 +1,13 @@ # Introduction Coluna is a framework written in Julia to implement a decomposition approach to optimize -block structured mixed-integer programs (MIP). +block-structured mixed-integer programs (MIP). Coluna relies on the tools of the JuMP-dev community at both ends of the problem treatment. -It uses the JuMP modeling language up front and MathOptInterface (MOI) to delegate master +It uses the JuMP modeling language upfront and MathOptInterface (MOI) to delegate master and subproblems to MIP solvers. -The user introduces an original MIP that model his problem using the JuMP along our specific +The user introduces an original MIP that models his problem using the JuMP along our specific extension BlockDecomposition that offers a syntax to specify the problem decomposition. Coluna reformulates the original MIP using Dantzig-Wolfe and Benders decomposition techniques. @@ -19,7 +19,7 @@ Coluna offers a "black-box" implementation of the branch-and-cut-and-price algor 2. BlockDecomposition allows the user to provide to Coluna his decomposition of the model. The BlockDecomposition syntax allows the user to implicilty define subsystems in the MIP on which the decomposition is based. These subsystems are described by rows and/or columns indices. -3. The reformulation associated to the decomposition defined by the user is automatically generated by Coluna, +3. The reformulation associated with the decomposition defined by the user is automatically generated by Coluna, without requiring any input from the user to define master columns, their reduced cost, pricing/separation problem, or Lagrangian bound. 4. A default column (and cut) generation procedure is implemented. It relies on underlying MOI optimizers to handle master and subproblems. @@ -43,18 +43,18 @@ You can install Coluna and its dependencies through the package manager of Julia ## Contributions -We welcome all contributions that help us to improve Coluna. You can suggest ways to enhance the package by talking with developers on the [discord chat](https://discordapp.com/invite/cg77wFW) dedicated to Coluna, or opening an issue via the [GitHub issues tracker](https://github.com/atoptima/Coluna.jl/issues) +We welcome all contributions that help us to improve Coluna. You can suggest ways to enhance the package by opening an issue via the [GitHub issues tracker](https://github.com/atoptima/Coluna.jl/issues) -Once the suggestion approved, you can open a Pull Request (PR) with the implementation of your suggestion. +Once the suggestion is approved, you can open a Pull Request (PR) with the implementation of your suggestion. Before requesting the review, make sure that your code follows the style guide and passes tests. -Do no forget to update docstrings and the tests when necessary. It is very important to keep clear the goal of the PR to make the review fast. So we might close a PR that fixes two unrelated issues or more. +Do not forget to update the docstrings and the tests when necessary. It is very important to keep clear the goal of the PR to make the review fast. So we might close a PR that fixes two unrelated issues or more. Coluna style follows the [blue style guide](https://github.com/invenia/BlueStyle) for Julia amended by the following instruction on naming : -> Names of variables and functions are treated equally. Use names that express what the variable/function do. > Either use : -> - `lowercasenospace` when the nam``is composed of three words or less with no ambiguity on words separation. +> Names of variables and functions are treated equally. Use names that express what the variable/function does. > Either use : +> - `lowercasenospace` when the name is composed of three words or less with no ambiguity on words separation. > - `snake_case` otherwise Note that the application of the style guide is a work in progress. diff --git a/docs/src/user/callbacks.md b/docs/src/user/callbacks.md index 1ca7fdb50..5bd6dfedc 100644 --- a/docs/src/user/callbacks.md +++ b/docs/src/user/callbacks.md @@ -5,14 +5,14 @@ algorithm. The more classical callbacks in a branch-and-price solver are: - Pricing callback that takes over the procedure to determine whether the current master LP - solution is optimum or produce an entering variable with negative reduced cost + solution is optimum or produces an entering variable with negative reduced cost - Separation callback that takes over the procedure to determine whether the current master - LP solution is feasible or produce a valid problem constraint that is violated + LP solution is feasible or produces a valid problem constraint that is violated - Branching callback that takes over the procedure to determine whether the current master - LP solution is integer or produce a valid branching disjunctive constraint that rules out + LP solution is integer or produces a valid branching disjunctive constraint that rules out the current fractional solution. -In this page, we use following aliases : +On this page, we use the following aliases : ```julia const BD = BlockDecomposition const MOI = MathOptInterface @@ -22,7 +22,7 @@ const MOI = MathOptInterface The pricing callback let you define how to solve the subproblems of a Dantzig-Wolfe decomposition to generate a new entering column in the master program. -This callback is usefull when you know an efficient algorithm to solve the subproblems, +This callback is useful when you know an efficient algorithm to solve the subproblems, i.e. an algorithm better than solving the subproblem with a MIP solver. Let us see an example with the generalized assignment problem for which the JuMP model takes the form: @@ -40,10 +40,10 @@ J = 1:nb_jobs @dantzig_wolfe_decomposition(model, dwdec, M) ``` -where as you can see, we omitted the knapsack constraints. +where, as you can see, we omitted the knapsack constraints. These constraints are implicitly defined by the algorithm called in the pricing callback. -Assume we have the following method that solves efficienlty a knapsack problem: +Assume we have the following method that solves efficiently a knapsack problem: ```julia solve_knp(job_costs, lb_jobs, ub_jobs, capacity) diff --git a/docs/src/user/start.md b/docs/src/user/start.md index ae5d2fad8..262ecdd25 100644 --- a/docs/src/user/start.md +++ b/docs/src/user/start.md @@ -1,7 +1,7 @@ # Quick start This quick start guide introduces the main features of Coluna through the example of the -Generalized Assignement Problem. +Generalized Assignment Problem. ## Problem @@ -35,10 +35,10 @@ w = [61 70 57 82 51 74 98 64 86 80 69 79 60 76 78 71 50 99 92 83 53 91 68 61 63 Q = [1020 1460 1530 1190] ``` -This model has a block structure : each knapsack constraint defines -an independent block and the set-partitionning constraints couple these independent +This model has a block structure: each knapsack constraint defines +an independent block and the set-partitioning constraints couple these independent blocks. By applying the Dantzig-Wolfe reformulation, each knapsack constraint forms -a tractable subproblem and the set-partitionning constraints are handled in a master problem. +a tractable subproblem and the set-partitioning constraints are handled in a master problem. To introduce the model, you need to load packages JuMP and BlockDecomposition. To optimize the problem, you need Coluna and a Julia package that provides a MIP solver such as GLPK. @@ -47,7 +47,7 @@ the problem, you need Coluna and a Julia package that provides a MIP solver such using JuMP, BlockDecomposition, Coluna, GLPK ``` -Next you instantiate the solver and define the algorithm that you use to optimize the problem. +Next, you instantiate the solver and define the algorithm that you use to optimize the problem. In this case, the algorithm is a "simple" branch-and-cut-and-price provided by Coluna. ```julia From 719744b15718323cb1994fa73c26b0a3b0baf3ce Mon Sep 17 00:00:00 2001 From: Lara di Cavalcanti Pontes <34425678+laradicp@users.noreply.github.com> Date: Tue, 2 Mar 2021 19:37:47 -0300 Subject: [PATCH 2/3] Add better error msg if max number of formulations reached (#457) * improve error msg max nb form * fix error msg max nb form * fix code Co-authored-by: Guillaume Marques --- src/MathProg/formulation.jl | 3 +++ test/unit/MathProg/formulations.jl | 15 +++++++++++++++ test/unit/unit_tests.jl | 2 ++ 3 files changed, 20 insertions(+) create mode 100644 test/unit/MathProg/formulations.jl diff --git a/src/MathProg/formulation.jl b/src/MathProg/formulation.jl index 38949773d..2a6083144 100644 --- a/src/MathProg/formulation.jl +++ b/src/MathProg/formulation.jl @@ -26,6 +26,9 @@ function Formulation{D}( parent_formulation = nothing, obj_sense::Type{<:Coluna.AbstractSense} = MinSense ) where {D<:AbstractFormDuty} + if form_counter.value >= MAX_NB_FORMULATIONS + error("Maximum number of formulations reached.") + end return Formulation{D}( getnewuid(form_counter), Counter(), Counter(), parent_formulation, NoOptimizer(), FormulationManager(), obj_sense, FormulationBuffer() diff --git a/test/unit/MathProg/formulations.jl b/test/unit/MathProg/formulations.jl new file mode 100644 index 000000000..f6b56ebb6 --- /dev/null +++ b/test/unit/MathProg/formulations.jl @@ -0,0 +1,15 @@ +function max_nb_form_unit() + coluna = optimizer_with_attributes( + Coluna.Optimizer, + "params" => Coluna.Params( + solver = Coluna.Algorithm.TreeSearchAlgorithm() # default BCP + ), + "default_optimizer" => GLPK.Optimizer # GLPK for the master & the subproblems + ) + @axis(M, 1:200) + model = BlockModel(coluna) + @variable(model, x[m in M], Bin) + @dantzig_wolfe_decomposition(model, decomposition, M) + @test_throws ErrorException("Maximum number of formulations reached.") optimize!(model) + return +end \ No newline at end of file diff --git a/test/unit/unit_tests.jl b/test/unit/unit_tests.jl index 292585dde..984ffa474 100644 --- a/test/unit/unit_tests.jl +++ b/test/unit/unit_tests.jl @@ -1,6 +1,7 @@ include("containers/nestedenum.jl") include("containers/solsandbounds.jl") +include("MathProg/formulations.jl") include("MathProg/types.jl") include("MathProg/variables.jl") @@ -17,6 +18,7 @@ function unit_tests() @testset "MathProg submodule" begin @testset "types.jl" begin + max_nb_form_unit() types_unit_tests() variables_unit_tests() end From f5f55537bce4640176283177aa8cf5a435b932c1 Mon Sep 17 00:00:00 2001 From: Guillaume Marques Date: Wed, 3 Mar 2021 15:28:58 +0100 Subject: [PATCH 3/3] v0.3.6 (#459) --- Project.toml | 2 +- src/optimize.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index b08b12624..1f2336ef2 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Coluna" uuid = "88b4ec78-b192-11e8-04aa-4d367dd96a64" authors = ["François Vanderbeck", "Guillaume Marques", "Vitor Nesello", "Ruslan Sadykov"] -version = "0.3.5" +version = "0.3.6" [deps] BlockDecomposition = "6cde8614-403a-11e9-12f1-c10d0f0caca0" diff --git a/src/optimize.jl b/src/optimize.jl index 977616cfe..b3e374c30 100644 --- a/src/optimize.jl +++ b/src/optimize.jl @@ -1,7 +1,7 @@ function _welcome_message() welcome = """ Coluna - Version 0.3.5 | 2021-02-12 | https://github.com/atoptima/Coluna.jl + Version 0.3.6 | 2021-03-03 | https://github.com/atoptima/Coluna.jl """ print(welcome) end