def run(self, init_state_list): ''' Run the computation (main entry point) init_star is the initial state fixed_dim_list, if used, is a list of dimensions with fixed initial values ''' Timers.reset() Timers.tic("total") self.setup(init_state_list) if self.settings.plot.plot_mode == PlotSettings.PLOT_INTERACTIVE: # make sure to store plot result for on_click listener to report on self.print_verbose( f"Setting store_plot_result to true since PLOT_INTERACTIVE has click listener" ) self.settings.plot.store_plot_result = True if self.settings.plot.store_plot_result: self.result.plot_data = PlotData(self.plotman.num_subplots) if self.settings.plot.plot_mode == PlotSettings.PLOT_NONE: self.run_to_completion() else: self.plotman.compute_and_animate() Timers.toc("total") if self.settings.stdout >= HylaaSettings.STDOUT_VERBOSE: Timers.print_stats() if self.result.has_concrete_error: self.print_normal( "Result: Error modes are reachable (found counter-example).\n") elif self.result.has_aggregated_error: self.print_normal("Result: System is safe, although error modes were reachable when aggregation " + \ "(overapproximation) was used.\n") else: self.print_normal( "Result: System is safe. Error modes are NOT reachable.\n") self.print_normal("Total Runtime: {:.2f} sec".format( Timers.top_level_timer.total_secs)) # assign results self.result.top_level_timer = Timers.top_level_timer Timers.reset() return self.result
def hylaa_v1_single(r, stepsize): 'Runs hylaa with the given settings, returning the seconds elapsed' settings = define_settings(stepsize) ha = define_ha(r) init = define_init_states(ha) print "Running hylaa with r={} stepsize={}...".format(r, stepsize), engine = HylaaEngine(ha, settings) engine.run(init) rv = engine.result.time Timers.reset() print rv return rv
plot_settings.extra_lines = [[(-100, y), (-100, -y), (0, 0), (-100, y)]] settings = HylaaSettings(step=0.1, max_time=200.0, plot_settings=plot_settings) settings.aggregation = False settings.deaggregation = False settings.simulation.threads = 1 return settings def run_hylaa(plot): 'Runs hylaa with the given settings, returning the HylaaResult object.' settings = define_settings(plot) ha = define_ha() init = define_init_states(ha) engine = HylaaEngine(ha, settings) engine.run(init) return engine.result if __name__ == '__main__': run_hylaa(True) # with plot Timers.reset() run_hylaa(False) # without plot print "total time reported is without plot (fix step)"
def setUp(self): Timers.reset()
def setUp(self): 'setup function' Timers.reset()
def setUp(self): 'setup function' Timers.reset() Star.init_plot_vecs(2, make_settings().plot)