def define_settings(): 'get the hylaa settings object' plot_settings = PlotSettings() plot_settings.plot_mode = PlotSettings.PLOT_INTERACTIVE plot_settings.xdim = 0 plot_settings.ydim = 1 return HylaaSettings(step=5.0E-4, max_time=2.0, plot_settings=plot_settings)
def define_settings(plot): 'get the hylaa settings object' plot_settings = PlotSettings() plot_settings.plot_mode = PlotSettings.PLOT_IMAGE if plot else PlotSettings.PLOT_NONE #plot_settings.plot_mode = PlotSettings.PLOT_NONE plot_settings.max_shown_polys = None plot_settings.xdim = 0 plot_settings.ydim = 1 plot_settings.label.title = "Spacecraft Rendezvous" plot_settings.filename = "rendezvous4.png" plot_settings.plot_size = (10, 10) plot_settings.label.big(size=32) plot_settings.label.x_label = '$x$' plot_settings.label.y_label = '$y$' y = 57.735 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 define_settings(): 'get the hylaa settings object' plot_settings = PlotSettings() plot_settings.plot_mode = PlotSettings.PLOT_IMAGE plot_settings.xdim = 0 plot_settings.ydim = 2 settings = HylaaSettings(step=0.1, max_time=10.0, disc_dyn=False, plot_settings=plot_settings) settings.stop_when_error_reachable = False return settings
def define_settings(): 'get the hylaa settings object' plot_settings = PlotSettings() plot_settings.plot_mode = PlotSettings.PLOT_NONE plot_settings.xdim = 0 plot_settings.ydim = 4 settings = HylaaSettings(step=0.001, max_time=0.001, plot_settings=plot_settings) settings.print_output = False settings.counter_example_filename = None return settings
def define_settings(): 'get the hylaa settings object' plot_settings = PlotSettings() plot_settings.plot_mode = PlotSettings.PLOT_IMAGE plot_settings.xdim = 0 plot_settings.ydim = 1 #plot_settings.label.axes_limits = (0.9, 1.1, 2.0, 6.0) settings = HylaaSettings(step=0.01, max_time=2.0, plot_settings=plot_settings) return settings
def define_settings(): 'get the hylaa settings object' plot_settings = PlotSettings() plot_settings.plot_mode = PlotSettings.PLOT_NONE plot_settings.xdim = 0 plot_settings.ydim = 8 settings = HylaaSettings(step=0.1, max_time=30.0, plot_settings=plot_settings) #settings.sim_tol = 1000.0 settings.use_presimulation = True #settings.aggregation = False #settings.solver = 'cvxopt-glpk' return settings
def define_settings(): 'get the hylaa settings object' plot_settings = PlotSettings() # save to a video file plot_settings.make_video("deaggregation.mp4", frames=150, fps=5) #plot_settings.plot_mode = PlotSettings.PLOT_IMAGE plot_settings.xdim = 0 plot_settings.ydim = 1 plot_settings.extra_lines = [[(-0.5, -4), (-0.5, -0), (0.5, -0), (0.5, -4)]] settings = HylaaSettings(step=0.25, max_time=6.0, plot_settings=plot_settings) settings.process_urgent_guards = True #settings.deaggregation = False #settings.aggregation = False settings.skip_step_times = True settings.simulation.threads = 1 return settings
def define_settings(): 'get the hylaa settings object' plot_settings = PlotSettings() plot_settings.plot_mode = PlotSettings.PLOT_IMAGE #plot_settings.plot_mode = PlotSettings.PLOT_VIDEO #plot_settings.video_frames = 220 #plot_settings.video_filename = "out.wma" #plot_settings.video_codec = None plot_settings.xdim = 0 plot_settings.ydim = 1 settings = HylaaSettings(step=0.1, max_time=10.0, plot_settings=plot_settings) return settings
def test_exp(self): '''test integration of x' = x''' ha = LinearHybridAutomaton('Harmonic Oscillator') ha.variables = ["x"] # x' = x a_matrix = np.array([[1]], dtype=float) c_vector = np.array([0], dtype=float) loc1 = ha.new_mode('loc') loc1.set_dynamics(a_matrix, c_vector) # x(0) = 1 init_list = [(ha.modes['loc'], HyperRectangle([(0.99, 1.01)]))] plot_settings = PlotSettings() plot_settings.plot_mode = PlotSettings.PLOT_NONE settings = HylaaSettings(step=0.1, max_time=1.1, plot_settings=plot_settings) settings.print_output = False engine = HylaaEngine(ha, settings) engine.load_waiting_list(init_list) # pop from waiting_list (doesn't advance state) engine.do_step() # x(t) should be e^t for i in xrange(10): engine.do_step() t = 0.1 * (i + 1) star = engine.cur_state self.assertTrue(star.contains_point([math.exp(t)]))
def test_rectangular(self): '''test integration of x' = 1, y' = 2''' ha = LinearHybridAutomaton('Harmonic Oscillator') ha.variables = ["x", "y"] # x' = x loc1 = ha.new_mode('loc') loc1.a_matrix = np.array([[0, 0], [0, 0]]) loc1.c_vector = np.array([1, 2]) # x(0) = 1, y(0) = 2 init_list = [(ha.modes['loc'], HyperRectangle([(0.99, 1.01), (1.99, 2.01)]))] plot_settings = PlotSettings() plot_settings.plot_mode = PlotSettings.PLOT_NONE settings = HylaaSettings(step=0.1, max_time=1.1, plot_settings=plot_settings) settings.print_output = False engine = HylaaEngine(ha, settings) engine.load_waiting_list(init_list) # x(t) = 1 + t; y(t) = 2 + 2*t # pop from waiting_list (doesn't advance state) engine.do_step() for i in xrange(10): engine.do_step() t = 0.1 * (i + 1) star = engine.cur_state point = [1 + t, 2 + 2 * t] self.assertTrue(star.contains_point(point))
def define_settings(stepsize): 'get the hylaa settings object' plot_settings = PlotSettings() #plot_settings.plot_mode = PlotSettings.PLOT_IMAGE if plot else PlotSettings.PLOT_NONE plot_settings.plot_mode = PlotSettings.PLOT_NONE plot_settings.max_shown_polys = None plot_settings.xdim = 0 plot_settings.ydim = 1 plot_settings.label.title = "Spacecraft Rendezvous (Abort)" plot_settings.filename = "rendezvous4_abort.png" plot_settings.plot_size = (10, 10) plot_settings.label.big(size=32) plot_settings.label.x_label = '$x$' plot_settings.label.y_label = '$y$' plot_settings.label.axes_limits = [-50, 50, -50, 50] #plot_settings.label.axes_limits = [-200, 200, -100, 100] y = 57.735 lines1 = [(-100, y), (-100, -y), (0, 0), (-100, y)] lines2 = [(-5, -5), (5, -5), (5, 5), (-5, 5), (-5, -5)] plot_settings.extra_lines = [lines1, lines2] #plot_settings.label.axes_limits = (-100, 100, -50, 0) settings = HylaaSettings(step=stepsize, max_time=250.0, plot_settings=plot_settings) settings.aggregation = False settings.deaggregation = False settings.skip_step_times = True settings.print_output = False settings.simulation.threads = 1 return settings