def main(): # path = '../Scenic-devel/examples/carla/pedestrian.scenic' path = 'fullScenario.scenic' sampler = ScenicSampler.fromScenario(path) falsifier_params = DotMap( n_iters=1, save_error_table=True, save_safe_table=True, error_table_path="failures_file.txt", ) falsifier_params.fal_thres = 4 # falsifier_params.fal_thres = 7 server_options = DotMap(maxSteps=800, verbosity=0) falsifier = generic_falsifier(sampler=sampler, falsifier_params=falsifier_params, server_class=ScenicServer, server_options=server_options, monitor=specification_monitor(specification)) t0 = time.time() falsifier.run_falsifier() t = time.time() - t0 print( f'Generated {len(falsifier.samples)} samples in {t} seconds with 1 worker' ) print(f'Number of counterexamples: {len(falsifier.error_table.table)}')
def test_webots_road(pathToLocalFile): path = pathToLocalFile('scenic_road.scenic') sampler = ScenicSampler.fromScenario(path) for i in range(3): sample = sampler.nextSample() print(f'Sample #{i}:') print(sample)
def test_driving_dynamic(pathToLocalFile): path = pathToLocalFile('scenic_driving.scenic') sampler = ScenicSampler.fromScenario(path) falsifier_params = DotMap( n_iters=3, save_error_table=False, save_safe_table=False, ) server_options = DotMap(maxSteps=2, verbosity=3) falsifier = generic_falsifier(sampler=sampler, falsifier_params=falsifier_params, server_class=ScenicServer, server_options=server_options) falsifier.run_falsifier()
from verifai.samplers.scenic_sampler import ScenicSampler from dotmap import DotMap from verifai.falsifier import generic_falsifier path_to_scenic_file = 'lane_cones.sc' sampler = ScenicSampler.fromScenario(path_to_scenic_file) MAX_ITERS = 20 PORT = 8888 MAXREQS = 5 BUFSIZE = 4096 falsifier_params = DotMap() falsifier_params.port = PORT falsifier_params.n_iters = MAX_ITERS falsifier_params.maxreqs = MAXREQS falsifier_params.bufsize = BUFSIZE falsifier_params.save_error_table = False falsifier_params.save_good_samples = False falsifier = generic_falsifier(sampler=sampler, sampler_type='scenic', falsifier_params=falsifier_params) falsifier.run_falsifier() print("Scenic Samples") for i in falsifier.samples.keys(): print("Sample: ", i) print(falsifier.samples[i])
def test_driving(pathToLocalFile): path = pathToLocalFile('scenic_driving.scenic') sampler = ScenicSampler.fromScenario(path) runSampler(sampler)
def test_webots_road(pathToLocalFile): path = pathToLocalFile('scenic_road.scenic') sampler = ScenicSampler.fromScenario(path) runSampler(sampler)