Skip to content

Commit

Permalink
status when i do the benchmark of previous problems
Browse files Browse the repository at this point in the history
  • Loading branch information
quimortiz committed Feb 26, 2024
1 parent e08c876 commit 980bc88
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 31 deletions.
35 changes: 26 additions & 9 deletions benchmark/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def generate_texpdf(filename_tex: str) -> None:
parser.add_argument("-bc", "--bench_cfg")
parser.add_argument("-d", "--dynamics")
parser.add_argument("-f", "--file_in")
parser.add_argument("-r", "--run", type=int, default=1)

args = parser.parse_args()

Expand Down Expand Up @@ -2566,6 +2567,9 @@ def check_if_best(value: float, field: str, problem: str, all_data) -> bool:
normalize = True

if normalize:

# chech that i have a normalizer

for p_id, p in enumerate(problems):

Dproblem = {}
Expand All @@ -2575,14 +2579,26 @@ def check_if_best(value: float, field: str, problem: str, all_data) -> bool:
if d["experiment"].problem == p
and d["experiment"].alg == "idbastar_iros"
]
assert len(data_p) == 1
data = data_p[0]["data"]
if not len(data_p) == 1:
normalize = False

for f in fields_normalizer:
Dproblem[f] = data[f]
Dnormalizer[p] = Dproblem
if normalize:
for p_id, p in enumerate(problems):
Dproblem = {}
data_p = [
d
for d in all_data
if d["experiment"].problem == p
and d["experiment"].alg == "idbastar_iros"
]
assert len(data_p) == 1
data = data_p[0]["data"]

print("Dnormalizer", Dnormalizer)
for f in fields_normalizer:
Dproblem[f] = data[f]
Dnormalizer[p] = Dproblem

print("Dnormalizer", Dnormalizer)

filename_pdf = f"../results_new/summary/summary_iros_plot_{date_time}_all.pdf"
print("writing pdf to ", filename_pdf)
Expand Down Expand Up @@ -2720,10 +2736,11 @@ def check_if_best(value: float, field: str, problem: str, all_data) -> bool:

def benchmark_iros(bench_cfg: str):

run_code = False
run_code = args.run

if run_code:
with open(bench_cfg) as f:
d = yaml.load(f, Loader=yaml.CLoader)
# with open(bench_cfg) as f:
# bench_cfg = yaml.load(f, Loader=yaml.CLoader)

experiments = __benchmark(bench_cfg)

Expand Down
11 changes: 6 additions & 5 deletions benchmark/config/algs/dbrrt_v0.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# general parameters, all systems and problems
default:
solver_id: 1
solver_id: 0
do_optimization: true
search_timelimit: 15000 # in ms
cost_delta_factor: 1
smooth_traj: true
smooth_traj: false
max_idb_it: 5

# you can set parameters per dynamial system
unicycle1_v0:
Expand Down Expand Up @@ -75,7 +76,7 @@ quad2dpole_v0:
# weight_goal: 200
weight_goal: 300
max_iter: 150
solver_id: 1
# solver_id: 1
# shortcut: true


Expand Down Expand Up @@ -103,13 +104,13 @@ quad3d_v0:
# goal_region: .7

delta: .35
# goal_region: .
goal_region: .7
# goal_region: .65
# max_motions: 5000
max_motions: 5000
max_iter: 100
# solver_id: 0
weight_goal: 100
weight_goal: 100
use_collision_shape: false
solver_id: 0
# use_mim_solvers: true
Expand Down
33 changes: 17 additions & 16 deletions benchmark/config/compare_selected_idbastar.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
trials: 5
trials: 10
timelimit: 60
n_cores: 8 # -1=auto


problems:
# - acrobot_v0/swing_up_empty
# - acrobot_v0/swing_up_obs_hard
# - car1_v0/kink_0
# - car1_v0/parallelpark_0
# - quad2d_v0/fall_through
# - quad2d_v0/quad_bugtrap
# - quad2dpole_v0/up_obs
# - quad2dpole_v0/window_hard
# - quadrotor_v0/recovery
# - quadrotor_v0/recovery_with_obs
# - quadrotor_v1/quad_one_obs
# - quadrotor_v1/window
- car1_v0/kink_0
- car1_v0/parallelpark_0
- quad2d_v0/fall_through
- quad2d_v0/quad_bugtrap
- quad2dpole_v0/up_obs
- quad2dpole_v0/window_hard
- quadrotor_v0/recovery
- quadrotor_v0/recovery_with_obs
- quadrotor_v1/quad_one_obs
- quadrotor_v1/window
- unicycle1_v0/bugtrap_0
# - unicycle1_v2/wall_0
- unicycle1_v2/wall_0
- unicycle2_v0/bugtrap_0
# - unicycle2_v0/parallelpark_0

- unicycle2_v0/parallelpark_0

# continue here!!
# in bidirectional search, add a different parameter for the delta of the connection?
algs:
- idbastar_iros
- dbrrt_v0
- dbrrt_v1
- dbrrt_v2
- geo_v0
- sst_v0
# - geo_v0
# - sst_v0


3 changes: 3 additions & 0 deletions include/dynoplan/dbrrt/dbrrt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct Options_dbrrt {
int max_valid_expansions_to_goal = 10;
bool use_connect_orig = false;
bool shortcut = false;
int max_idb_it = 10;

// if 1, i take the first primitive that is valid.
// if > 1 i wait until max_valid_expansions are valid and then i take the
Expand Down Expand Up @@ -84,6 +85,8 @@ struct Options_dbrrt {
loader.set(VAR_WITH_NAME(max_valid_expansions_to_goal));
loader.set(VAR_WITH_NAME(use_connect_orig));
loader.set(VAR_WITH_NAME(shortcut));
loader.set(VAR_WITH_NAME(max_idb_it));

}

void add_options(po::options_description &desc) { __load_data(&desc, true); }
Expand Down
2 changes: 1 addition & 1 deletion src/dbrrt/dbrrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2353,7 +2353,7 @@ void idbrrt(const dynobench::Problem &problem,
double time_search = 0;
double time_opt = 0;

while (!finished && it < max_it) {
while (!finished && it < options_dbrrt.max_idb_it) {
if (it > 0) {
options_dbrrt_local.delta *= delta_factor;
options_dbrrt_local.goal_region *= delta_factor;
Expand Down

0 comments on commit 980bc88

Please sign in to comment.