Skip to content

Commit

Permalink
Merge pull request #8 from MarineRoboticsGroup/kjd/refactor
Browse files Browse the repository at this point in the history
Major refactor, API changes, new tests
  • Loading branch information
keevindoherty authored Nov 8, 2024
2 parents ea98708 + 2977f0d commit 079663f
Show file tree
Hide file tree
Showing 44 changed files with 1,051 additions and 2,051 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install flake8 pytest pytest-benchmark
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
Expand Down
24 changes: 8 additions & 16 deletions examples/g2o_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
import numpy as np
import networkx as nx
from timeit import default_timer as timer
from pose_graph_utils import read_g2o_file, plot_poses, rpm_to_mac, RelativePoseMeasurement, poses_ate_tran, poses_rpe_rot
from pose_graph_utils import split_edges, read_g2o_file, plot_poses, rpm_to_mac, RelativePoseMeasurement, poses_ate_tran, poses_rpe_rot

# MAC requirements
from mac import MAC
from mac.baseline import NaiveGreedy
from mac.greedy_eig import GreedyEig
from mac.greedy_esp import GreedyESP
from mac.utils import split_edges, Edge, round_madow
from mac.solvers import MAC, NaiveGreedy
from mac.utils.graphs import Edge
from mac.utils.rounding import round_madow

import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
Expand Down Expand Up @@ -267,14 +265,14 @@ def to_sesync_format(measurements):
# pass

# Make a MAC Solver
mac = MAC(odom_edges, lc_edges, num_poses, use_cache=True, fiedler_method="tracemin_cholesky")
mac = MAC(odom_edges, lc_edges, num_poses, fiedler_method="tracemin_cholesky")

# Make a Naive Solver
naive = NaiveGreedy(lc_edges)

# Make a GreedyEig Solver
if run_greedy:
# greedy_eig = GreedyEig(rpm_to_mac(odom_measurements), rpm_to_mac(lc_measurements), num_poses)
from mac.solvers.greedy_esp import GreedyESP
greedy_esp = GreedyESP(odom_edges, lc_edges, num_poses, lazy=True)

#############################
Expand Down Expand Up @@ -318,7 +316,7 @@ def to_sesync_format(measurements):

# Solve the relaxed maximum algebraic connectivity augmentation problem.
start = timer()
result, unrounded, upper, rtime = mac.fw_subset(w_init, num_lc, max_iters=20, rounding="nearest", return_rounding_time=True)
result, unrounded, upper, rtime = mac.solve(num_lc, w_init, max_iters=20, rounding="nearest", return_rounding_time=True, use_cache=True)
end = timer()
solve_time = end - start
times.append(solve_time)
Expand All @@ -337,14 +335,8 @@ def to_sesync_format(measurements):
# point solution every time.
madow_times.append(solve_time + (end - start) - rtime)

# Solve the relaxed maximum algebraic connectivity augmentation problem.
# Solve the greedy k-edge selection problem
if run_greedy:
# start = timer()
# greedy_eig_result, _ = greedy_eig.subset(num_lc)
# end = timer()
# greedy_eig_times.append(end - start)
# greedy_eig_results.append(greedy_eig_result)

num_lcs = [int(pct_lc * len(lc_measurements)) for pct_lc in percent_lc]
greedy_esp_results, _, greedy_esp_times = greedy_esp.subsets_lazy(num_lcs, verbose=True)
pass
Expand Down
148 changes: 0 additions & 148 deletions examples/g2o_mac_cache.py

This file was deleted.

61 changes: 0 additions & 61 deletions examples/greedy_eig_test.py

This file was deleted.

50 changes: 0 additions & 50 deletions examples/greedy_esp_example.py

This file was deleted.

Loading

0 comments on commit 079663f

Please sign in to comment.