Skip to content

Commit

Permalink
slam dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
harsha committed May 8, 2024
1 parent 365ced8 commit e1b7511
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 20 deletions.
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
LaplacianOpt.jl Change Log
=========================

### Staged
- Solver logging option added in `optimizer.jl`
### v0.7.0
- Solver logging option added in `optimizers.jl`
- Added option `minors_on_augment_edges` to include principal minor cuts only corresponding to vertices with augmentable edges - helps in reducing run times
- Cleaned up `get_minor_idx` function to make it more efficient
- Function `_PMinorIdx` gets updated accordingly
- Minor bug fix in `heuristics.jl`
- Minor bug fix in handling 1x1 principal minors
- Added SLAM dataset instances

### v0.6.2
- Minor fix for testing eigen cut orthogonality if `projected_eigen_cuts` is active
Expand Down Expand Up @@ -92,13 +95,13 @@ LaplacianOpt.jl Change Log
### v0.1.6
- Fixed Tikzgraph issue in tests
- Transitioned from LightGraphs to Graphs
- Updated and cleaned up `examples/optimizer.jl`
- Updated and cleaned up `examples/optimizers.jl`
- `src/data.jl` cleanup for handling `"optimizer"`
- Minor docs update

### v0.1.5
- Added CITATION.bib
- Added support for Gurobi MIP solver in `examples/optimizer.jl`
- Added support for Gurobi MIP solver in `examples/optimizers.jl`
- Updated `LO` to `LOpt`
- `lopt_model.jl` function calls updated with `LOpt`
- Minor docs cleanups
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LaplacianOpt"
uuid = "bb20392f-64fb-4001-92e8-14b3aedd5a9e"
authors = ["Harsha Nagarajan"]
version = "0.6.2"
version = "0.7.0"

[deps]
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Expand Down
7 changes: 3 additions & 4 deletions examples/instances/100_nodes/100_1.json

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions examples/instances/100_nodes/100_1_old.json

This file was deleted.

4 changes: 4 additions & 0 deletions examples/instances/100_nodes/100_1_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{"edges_to_augment":[[[10,67],1.0],[[59,78],1.0],[[69,90],1.0],[[38,52],1.0],[[1,71],1.0],[[54,93],1.0],[[36,50],1.0],[[21,71],1.0],[[24,43],1.0],[[13,84],1.0]],
"num_nodes":100,
"augment_budget": 5,
"edges_existing":[[[1,2],1.0],[[2,3],1.0],[[3,4],1.0],[[4,5],1.0],[[5,6],1.0],[[6,7],1.0],[[7,8],1.0],[[8,9],1.0],[[9,10],1.0],[[10,11],1.0],[[11,12],1.0],[[12,13],1.0],[[13,14],1.0],[[14,15],1.0],[[15,16],1.0],[[16,17],1.0],[[17,18],1.0],[[18,19],1.0],[[19,20],1.0],[[20,21],1.0],[[21,22],1.0],[[22,23],1.0],[[23,24],1.0],[[24,25],1.0],[[25,26],1.0],[[26,27],1.0],[[27,28],1.0],[[28,29],1.0],[[29,30],1.0],[[30,31],1.0],[[31,32],1.0],[[32,33],1.0],[[33,34],1.0],[[34,35],1.0],[[35,36],1.0],[[36,37],1.0],[[37,38],1.0],[[38,39],1.0],[[39,40],1.0],[[40,41],1.0],[[41,42],1.0],[[42,43],1.0],[[43,44],1.0],[[44,45],1.0],[[45,46],1.0],[[46,47],1.0],[[47,48],1.0],[[48,49],1.0],[[49,50],1.0],[[50,51],1.0],[[51,52],1.0],[[52,53],1.0],[[53,54],1.0],[[54,55],1.0],[[55,56],1.0],[[56,57],1.0],[[57,58],1.0],[[58,59],1.0],[[59,60],1.0],[[60,61],1.0],[[61,62],1.0],[[62,63],1.0],[[63,64],1.0],[[64,65],1.0],[[65,66],1.0],[[66,67],1.0],[[67,68],1.0],[[68,69],1.0],[[69,70],1.0],[[70,71],1.0],[[71,72],1.0],[[72,73],1.0],[[73,74],1.0],[[74,75],1.0],[[75,76],1.0],[[76,77],1.0],[[77,78],1.0],[[78,79],1.0],[[79,80],1.0],[[80,81],1.0],[[81,82],1.0],[[82,83],1.0],[[83,84],1.0],[[84,85],1.0],[[85,86],1.0],[[86,87],1.0],[[87,88],1.0],[[88,89],1.0],[[89,90],1.0],[[90,91],1.0],[[91,92],1.0],[[92,93],1.0],[[93,94],1.0],[[94,95],1.0],[[95,96],1.0],[[96,97],1.0],[[97,98],1.0],[[98,99],1.0],[[99,100],1.0]]}
4 changes: 4 additions & 0 deletions examples/instances/SLAM_dataset/CSAIL.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions examples/instances/SLAM_dataset/ais2klinik.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions examples/instances/SLAM_dataset/intel.json

Large diffs are not rendered by default.

File renamed without changes.
19 changes: 15 additions & 4 deletions examples/run_examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using JuMP
using CPLEX
# using GLPK

include("optimizer.jl")
include("optimizers.jl")

#-----------------------------------#
# MIP solver #
Expand All @@ -18,13 +18,23 @@ lopt_optimizer = get_cplex(solver_log = true)
Option I: Let the package parse a JSON file and obtain the data dictionary (data_dict)
Sample JSON format: Check examples/instances
=#

# Spanning tree dataset
function data_I(num_nodes::Int, instance::Int)
# Data format has to be as given in this JSON file
file_path =
joinpath(@__DIR__, "instances/$(num_nodes)_nodes/$(num_nodes)_$(instance).json")
data_dict = LOpt.parse_file(file_path)
# augment_budget = (num_nodes - 1) # spanning tree constraint
augment_budget = 5
augment_budget = (num_nodes - 1) # spanning tree constraint
return data_dict, augment_budget
end

# Loading SLAM dataset
function data_SLAM(instance::String)
# Data format has to be as given in this JSON file
file_path = joinpath(@__DIR__, "instances/SLAM_dataset/$(instance).json")
data_dict = LOpt.parse_file(file_path)
augment_budget = 10
return data_dict, augment_budget
end

Expand All @@ -44,9 +54,10 @@ end
#-------------------------------#
# User-defined params #
#-------------------------------#
num_nodes = 100
num_nodes = 8
instance = 1
data_dict, augment_budget = data_I(num_nodes, instance)
# data_dict, augment_budget = data_SLAM("CSAIL") # "CSAIL", "intel", "ais2klinik"
# data_dict, augment_budget = data_II()

params = Dict{String,Any}("data_dict" => data_dict, "augment_budget" => augment_budget)
Expand Down
2 changes: 1 addition & 1 deletion src/constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function constraint_lazycallback_wrapper(lom::LaplacianOptModel; optimizer = not
if !(lom.options.formulation_type == "max_span_tree")
if (
size(lom.options.eigen_cuts_sizes)[1] > 0 &&
minimum(lom.options.eigen_cuts_sizes) >= 2
minimum(lom.options.eigen_cuts_sizes) >= 1
) || lom.options.sdp_relaxation
W_val = JuMP.callback_value.(Ref(cb_cuts), lom.variables[:W_var])
LOpt.constraint_eigen_cuts(W_val, cb_cuts, lom)
Expand Down
7 changes: 5 additions & 2 deletions src/heuristics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,10 @@ function refinement_tree(
)
end
else
Memento.eror(_LOGGER, "Augment budget should be greater than one.")
Memento.error(
_LOGGER,
"For kopt_parameter = 2, augment budget should be >= 2",
)
end
elseif kopt_parameter == 3
if augment_budget >= 3
Expand All @@ -560,7 +563,7 @@ function refinement_tree(
Memento.error(_LOGGER, "Augment budget should be greater than two.")
end
else
Memento.eror(_LOGGER, "kopt_parameter > 3 is currently not supported.")
Memento.error(_LOGGER, "kopt_parameter > 3 is currently not supported.")
end
return Matrix(Graphs.adjacency_matrix(G)),
LOpt.algebraic_connectivity(
Expand Down
2 changes: 1 addition & 1 deletion src/lopt_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ end
function lazycallback_status(lom::LaplacianOptModel)
if (
size(lom.options.eigen_cuts_sizes)[1] > 0 &&
minimum(lom.options.eigen_cuts_sizes) >= 2
minimum(lom.options.eigen_cuts_sizes) >= 1
) ||
lom.options.topology_flow_cuts ||
lom.options.soc_linearized_cuts ||
Expand Down

0 comments on commit e1b7511

Please sign in to comment.