Skip to content

Commit

Permalink
clean ups
Browse files Browse the repository at this point in the history
  • Loading branch information
harshangrjn committed Oct 20, 2021
1 parent 9fb5159 commit e165fd4
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 93 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ LaplacianOpt.jl Change Log
- Added CITATION.bib
- Added support for Gurobi MIP solver in `examples/solver.jl`
- Updated `LO` to `LOpt`
- `lopt_model.jl` function calls updated with `LOpt`
- Minor docs cleanups

### v0.1.4
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Documentation for LaplacianOpt.jl

## Installation
LaplacianOpt.jl's documentation is generated using [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl). To install it, run the following command in a Julia session:
LaplacianOpt's documentation is generated using [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl). To install it, run the following command in a Julia session:

```julia
Pkg.add("Documenter")
Expand Down
1 change: 0 additions & 1 deletion src/constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ function constraint_eigen_cuts_on_full_matrix(W_val::Matrix{Float64}, cb_cuts, l
else

Memento.warn(_LOGGER, "Eigen cut corresponding to the negative eigenvalue could not be added")

end
end

Expand Down
52 changes: 26 additions & 26 deletions src/lopt_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,41 @@ function build_LOModel(data::Dict{String, Any})

lom = LaplacianOptModel(data)

variable_LOModel(lom)
LOpt.variable_LOModel(lom)

if lom.data["solution_type"] == "exact"
constraint_LOModel(lom)
LOpt.constraint_LOModel(lom)
end

objective_LOModel(lom)
LOpt.objective_LOModel(lom)

return lom
end

function variable_LOModel(lom::LaplacianOptModel)

variable_lifted_W_matrix(lom)
variable_edge_onoff(lom)
variable_algebraic_connectivity(lom)
LOpt.variable_lifted_W_matrix(lom)
LOpt.variable_edge_onoff(lom)
LOpt.variable_algebraic_connectivity(lom)

return
end

function constraint_LOModel(lom::LaplacianOptModel)

constraint_build_W_var_matrix(lom)
LOpt.constraint_build_W_var_matrix(lom)

constraint_topology_no_self_loops(lom)
constraint_topology_vertex_cutset(lom)
constraint_topology_total_edges(lom)
LOpt.constraint_topology_no_self_loops(lom)
LOpt.constraint_topology_vertex_cutset(lom)
LOpt.constraint_topology_total_edges(lom)

constraint_lazycallback_wrapper(lom)
LOpt.constraint_lazycallback_wrapper(lom)

return
end

function objective_LOModel(lom::LaplacianOptModel)
objective_maximize_algebraic_connectivity(lom)
LOpt.objective_maximize_algebraic_connectivity(lom)

return
end
Expand Down Expand Up @@ -70,7 +70,7 @@ function optimize_LOModel!(lom::LaplacianOptModel; optimizer=nothing)

Memento.debug(_LOGGER, "JuMP model optimize time: $(time() - start_time)")

lom.result = build_LOModel_result(lom, solve_time)
lom.result = LOpt.build_LOModel_result(lom, solve_time)

return lom.result
end
Expand All @@ -84,7 +84,7 @@ function run_LOpt_model(params::Dict{String, Any}, lom_optimizer::MOI.OptimizerW
result_lopt = LOpt.optimize_LOModel!(model_lopt, optimizer = lom_optimizer)

if visualize_solution
LaplacianOpt.visualize_solution(result_lopt, data, visualizing_tool = visualizing_tool)
LOpt.visualize_solution(result_lopt, data, visualizing_tool = visualizing_tool)
end

return result_lopt
Expand All @@ -98,7 +98,7 @@ function run_MaxSpanTree_model(params::Dict{String, Any}, lom_optimizer::MOI.Opt
result_mst = LOpt.optimize_LOModel!(model_mst, optimizer = lom_optimizer)

if visualize_solution
LaplacianOpt.visualize_solution(result_mst, data, visualizing_tool = visualizing_tool)
LOpt.visualize_solution(result_mst, data, visualizing_tool = visualizing_tool)
end

return result_mst
Expand All @@ -109,43 +109,43 @@ function build_MaxSpanTree_model(data::Dict{String, Any}, lazy_callback::Bool)

m_mst = LaplacianOptModel(data)

variable_MaxSpanTree_model(m_mst, lazy_callback)
LOpt.variable_MaxSpanTree_model(m_mst, lazy_callback)

constraint_MaxSpanTree_model(m_mst, lazy_callback)
LOpt.constraint_MaxSpanTree_model(m_mst, lazy_callback)

objective_MaxSpanTree_model(m_mst)
LOpt.objective_MaxSpanTree_model(m_mst)

return m_mst
end

function objective_MaxSpanTree_model(lom::LaplacianOptModel)

objective_maximize_spanning_tree_cost(lom)
LOpt.objective_maximize_spanning_tree_cost(lom)

return
end

function variable_MaxSpanTree_model(lom::LaplacianOptModel, lazy_callback::Bool)

variable_edge_onoff(lom)
LOpt.variable_edge_onoff(lom)

if !lazy_callback
variable_multi_commodity_flow(lom)
LOpt.variable_multi_commodity_flow(lom)
end

return
end

function constraint_MaxSpanTree_model(lom::LaplacianOptModel, lazy_callback::Bool)

constraint_topology_no_self_loops(lom)
constraint_topology_vertex_cutset(lom)
constraint_topology_total_edges(lom)
LOpt.constraint_topology_no_self_loops(lom)
LOpt.constraint_topology_vertex_cutset(lom)
LOpt.constraint_topology_total_edges(lom)

if lazy_callback
constraint_lazycallback_wrapper(lom)
LOpt.constraint_lazycallback_wrapper(lom)
else
constraint_topology_multi_commodity_flow(lom)
LOpt.constraint_topology_multi_commodity_flow(lom)
end

return
Expand Down
62 changes: 0 additions & 62 deletions src/quickguide.md

This file was deleted.

4 changes: 2 additions & 2 deletions src/relaxations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ z <= JuMP.upper_bound(x)*y + JuMP.lower_bound(y)*x - JuMP.upper_bound(x)*JuMP.lo
```
"""
function relaxation_bilinear(m::JuMP.Model, xy::JuMP.VariableRef, x::JuMP.VariableRef, y::JuMP.VariableRef)
lb_x, ub_x = variable_domain(x)
lb_y, ub_y = variable_domain(y)
lb_x, ub_x = LOpt.variable_domain(x)
lb_y, ub_y = LOpt.variable_domain(y)

if (lb_x == 0) && (ub_x == 1) && ((lb_y != 0) || (ub_y != 1))

Expand Down
2 changes: 1 addition & 1 deletion src/solution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function build_LOModel_result(lom::LaplacianOptModel, solve_time::Number)
solution = Dict{String,Any}()

if result_count > 0
solution = build_LOModel_solution(lom)
solution = LOpt.build_LOModel_solution(lom)
else
Memento.warn(_LOGGER, "LaplacianOpt model has no results - solution cannot be built")
end
Expand Down

0 comments on commit e165fd4

Please sign in to comment.