This tutorial explains how to use the batch processing script to solve CommonRoad planning problems in parallel. The configuration for batch processing is stored in batch_processing_config.yaml
. Some of the parameters are explained as follows:
Parameters specified under the default
block will be applied to all scenarios. If you wish to specify a different paramter for specific scenarios, simply insert a new block with the content of the default
block copied, and overwrite parameters therein. This new block should be named after the ID of the sceanrio that you wish to aplly the parameters to. Related parameters are explained as follows:
Note: the paths can either be relative or absolute.
To start the search with batch processing, you can either directly run SMP/batch_processing/batch_processing_parallel.py
in IDEs (e.g. PyCharm) with commonroad-search/
marked as sources root, or run the following script.
In parallel batch processing, the search are carried out on multiple threads simultaneously. This reduces the overall time required to test your algorithm on all the given scenarios. One drawback is that it is not very easy to debug your code with parallel batch processing.
%load_ext autoreload
%autoreload 2
import os
import sys
# add the folder containing batch processing script into python path
sys.path.append(os.path.join(os.getcwd(), "../../"))
from SMP.batch_processing.batch_processing_parallel import run_parallel_processing
run_parallel_processing()
Alternatively, one can use the SMP/batch_processing/batch_processing_sequential.py
script to carry out the search sequentially on a single thread. This is a more user-friendly approach if you wish you debug your code in IDES (e.g. creating breakpoints in PyCharm) but still have it run against multiple scenarios.
from SMP.batch_processing.batch_processing_sequential import run_sequential_processing
run_sequential_processing()