Skip to content

Commit 079663f

Browse files
Merge pull request #8 from MarineRoboticsGroup/kjd/refactor
Major refactor, API changes, new tests
2 parents ea98708 + 2977f0d commit 079663f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1051
-2051
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip
29-
pip install flake8 pytest
29+
pip install flake8 pytest pytest-benchmark
3030
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3131
- name: Lint with flake8
3232
run: |

examples/g2o_experiment.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
import numpy as np
44
import networkx as nx
55
from timeit import default_timer as timer
6-
from pose_graph_utils import read_g2o_file, plot_poses, rpm_to_mac, RelativePoseMeasurement, poses_ate_tran, poses_rpe_rot
6+
from pose_graph_utils import split_edges, read_g2o_file, plot_poses, rpm_to_mac, RelativePoseMeasurement, poses_ate_tran, poses_rpe_rot
77

88
# MAC requirements
9-
from mac import MAC
10-
from mac.baseline import NaiveGreedy
11-
from mac.greedy_eig import GreedyEig
12-
from mac.greedy_esp import GreedyESP
13-
from mac.utils import split_edges, Edge, round_madow
9+
from mac.solvers import MAC, NaiveGreedy
10+
from mac.utils.graphs import Edge
11+
from mac.utils.rounding import round_madow
1412

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

269267
# Make a MAC Solver
270-
mac = MAC(odom_edges, lc_edges, num_poses, use_cache=True, fiedler_method="tracemin_cholesky")
268+
mac = MAC(odom_edges, lc_edges, num_poses, fiedler_method="tracemin_cholesky")
271269

272270
# Make a Naive Solver
273271
naive = NaiveGreedy(lc_edges)
274272

275273
# Make a GreedyEig Solver
276274
if run_greedy:
277-
# greedy_eig = GreedyEig(rpm_to_mac(odom_measurements), rpm_to_mac(lc_measurements), num_poses)
275+
from mac.solvers.greedy_esp import GreedyESP
278276
greedy_esp = GreedyESP(odom_edges, lc_edges, num_poses, lazy=True)
279277

280278
#############################
@@ -318,7 +316,7 @@ def to_sesync_format(measurements):
318316

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

340-
# Solve the relaxed maximum algebraic connectivity augmentation problem.
338+
# Solve the greedy k-edge selection problem
341339
if run_greedy:
342-
# start = timer()
343-
# greedy_eig_result, _ = greedy_eig.subset(num_lc)
344-
# end = timer()
345-
# greedy_eig_times.append(end - start)
346-
# greedy_eig_results.append(greedy_eig_result)
347-
348340
num_lcs = [int(pct_lc * len(lc_measurements)) for pct_lc in percent_lc]
349341
greedy_esp_results, _, greedy_esp_times = greedy_esp.subsets_lazy(num_lcs, verbose=True)
350342
pass

examples/g2o_mac_cache.py

Lines changed: 0 additions & 148 deletions
This file was deleted.

examples/greedy_eig_test.py

Lines changed: 0 additions & 61 deletions
This file was deleted.

examples/greedy_esp_example.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)