Skip to content

Commit

Permalink
Merge pull request #4 from utiasASRL/use-certificate-tools
Browse files Browse the repository at this point in the history
WIP: use certificate tools
  • Loading branch information
duembgen authored Dec 29, 2023
2 parents fc944b0 + 0a9392f commit f9239ac
Show file tree
Hide file tree
Showing 47 changed files with 1,083 additions and 1,161 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.CONSTRAINT_LEARNING_PAT }}
submodules: recursive
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ venv/
*.swp

*.code-workspace
solve_mosek.ptf
solve_cvxpy*.ptf
build/
dist/
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
url = [email protected]:utiasASRL/poly_matrix
[submodule "starloc"]
path = starloc
url = [email protected]:duembgen/starloc
url = [email protected]:utiasASRL/starloc
[submodule "certifiable-tools"]
path = certifiable-tools
url = [email protected]:utiasASRL/certifiable-tools
13 changes: 6 additions & 7 deletions _scripts/generate_all_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
import matplotlib

try:
matplotlib.use("TkAgg")
# matplotlib.use("TkAgg")
matplotlib.use("Agg")
except:
pass

if __name__ == "__main__":
n_seeds = 1 # was 10
n_seeds = 1 # was 10
recompute = False
tightness = True
scalability = True
Expand All @@ -38,12 +39,10 @@
scalability=scalability,
)



n_successful = 3 # was 100
run_datasets_stereo(recompute=False, n_successful=n_successful)
n_successful = 3 # was 100
run_datasets_ro(recompute=False, n_successful=n_successful)
run_datasets_stereo(recompute=False, n_successful=n_successful)

n_successful = 3 # was 10
n_successful = 3 # was 10
run_datasets_ro(recompute=True, n_successful=n_successful)
run_datasets_stereo(recompute=True, n_successful=n_successful)
2 changes: 1 addition & 1 deletion _scripts/run_all_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pandas as pd
import numpy as np

from lifters.learner import Learner
from auto_template.learner import Learner
from lifters.mono_lifter import MonoLifter
from lifters.wahba_lifter import WahbaLifter
from lifters.stereo2d_lifter import Stereo2DLifter
Expand Down
5 changes: 2 additions & 3 deletions _scripts/run_datasets_ro.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@

import pandas as pd

from utils.real_experiments import (
from auto_template.real_experiments import (
Experiment,
run_experiments,
plot_results,
plot_local_vs_global,
)
from auto_template.learner import TOL_RANK_ONE, TOL_REL_GAP

DATASET_ROOT = str(Path(__file__).parent.parent)

Expand Down Expand Up @@ -74,8 +75,6 @@ def run_all(recompute=RECOMPUTE, n_successful=100, plot_poses=False):

plot_local_vs_global(df, fname_root=fname_root)

from lifters.learner import TOL_RANK_ONE, TOL_REL_GAP

plot_results(
df,
ylabel="SVR",
Expand Down
11 changes: 7 additions & 4 deletions _scripts/run_datasets_stereo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
except:
pass

from utils.real_experiments import Experiment
from utils.real_experiments import run_experiments, plot_results, plot_local_vs_global
from auto_template.learner import TOL_RANK_ONE, TOL_REL_GAP
from auto_template.real_experiments import Experiment
from auto_template.real_experiments import (
run_experiments,
plot_results,
plot_local_vs_global,
)

DATASET_ROOT = str(Path(__file__).parent.parent)
MAX_N_LANDMARKS = 8 # 10
Expand Down Expand Up @@ -80,8 +85,6 @@ def run_all(recompute=RECOMPUTE, n_successful=10):
# cost below is found empirically
plot_local_vs_global(df, fname_root=fname_root, cost_thresh=1e3)

from lifters.learner import TOL_RANK_ONE, TOL_REL_GAP

plot_results(
df,
ylabel="RDG",
Expand Down
12 changes: 6 additions & 6 deletions _scripts/run_other_study.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import numpy as np

from utils.sim_experiments import plot_scalability, save_table
from lifters.learner import Learner
from lifters.mono_lifter import MonoLifter
from utils.plotting_tools import savefig

from utils.sim_experiments import (
from auto_template.learner import Learner
from auto_template.sim_experiments import (
plot_scalability,
run_oneshot_experiment,
run_scalability_new,
)
from lifters.mono_lifter import MonoLifter
from utils.plotting_tools import savefig


DEBUG = False

Expand Down
12 changes: 5 additions & 7 deletions _scripts/run_range_only_study.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import numpy as np

from lifters.learner import Learner
from auto_template.learner import Learner
from lifters.range_only_lifters import RangeOnlyLocLifter

from utils.plotting_tools import savefig
from utils.sim_experiments import plot_scalability, save_table
from utils.sim_experiments import run_oneshot_experiment, run_scalability_new
from auto_template.sim_experiments import plot_scalability
from auto_template.sim_experiments import run_oneshot_experiment, run_scalability_new


n_positions = 3
Expand All @@ -15,7 +15,7 @@
DEBUG = False

RESULTS_DIR = "_results"
#RESULTS_DIR = "_results_server"
# RESULTS_DIR = "_results_server"


def range_only_tightness():
Expand Down Expand Up @@ -86,9 +86,7 @@ def range_only_scalability_new(n_seeds, recompute):
fname_root = f"{RESULTS_DIR}/scalability_{learner.lifter}"

df_sub = df[df.type != "from scratch"]["t solve SDP"]
fig, axs = plot_scalability(
df, log=True, start="t ", legend_idx=1
)
fig, axs = plot_scalability(df, log=True, start="t ", legend_idx=1)

# [ax.set_ylim(10, 1000) for ax in axs.values()]

Expand Down
13 changes: 6 additions & 7 deletions _scripts/run_stereo_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@
# matplotlib.use('Agg') # non-interactive
# plt.ioff()

from utils.sim_experiments import (
from auto_template.learner import Learner
from auto_template.sim_experiments import (
plot_scalability,
run_scalability_new,
run_oneshot_experiment,
run_scalability_plot,
)
from utils.sim_experiments import plot_scalability, save_table
from utils.plotting_tools import savefig

from lifters.learner import Learner
from lifters.stereo2d_lifter import Stereo2DLifter
from lifters.stereo3d_lifter import Stereo3DLifter
from utils.plotting_tools import savefig

DEBUG = False

RESULTS_DIR = "_results"
#RESULTS_DIR = "_results_server"
# RESULTS_DIR = "_results_server"


def stereo_tightness(d=2, n_landmarks=None):
"""
Expand Down Expand Up @@ -106,7 +105,7 @@ def stereo_scalability_new(n_seeds, recompute, d=2):
param_list=n_landmarks_list,
n_seeds=n_seeds,
recompute=recompute,
results_folder=RESULTS_DIR
results_folder=RESULTS_DIR,
)
if df is None:
return
Expand Down
Loading

0 comments on commit f9239ac

Please sign in to comment.