def on_exit(self, event): """Called when the application is to be finished""" dlg = wx.MessageDialog( self._mainframe, 'SUMOPy is about to close.\nDo you want to SAVE the current scenario before closing?', 'Closing SUMOPy', wx.YES_NO | wx.CANCEL | wx.ICON_QUESTION) ans = dlg.ShowModal() dlg.Destroy() # print ' # ans,wx.ID_CANCEL,wx.ID_YES,wx.ID_NO',ans,wx.ID_CANCEL,wx.ID_YES,wx.ID_NO if ans == wx.ID_CANCEL: # print ' do not quit!' pass elif ans == wx.ID_YES: # print ' save and quit' scenario = self.get_scenario() cm.save_obj(scenario, scenario.get_rootfilepath() + '.obj', is_not_save_parent=False) self._mainframe.destroy() elif ans == wx.ID_NO: # print 'quit immediately' self._mainframe.destroy()
def on_exit(self, event): """Called when the application is to be finished""" dlg = wx.MessageDialog(self._mainframe, 'SUMOPy is about to close.\nDo you want to SAVE the current scenario before closing?', 'Closing SUMOPy', wx.YES_NO | wx.CANCEL | wx.ICON_QUESTION) ans = dlg.ShowModal() dlg.Destroy() # print ' ans,wx.ID_CANCEL,wx.ID_YES,wx.ID_NO',ans,wx.ID_CANCEL,wx.ID_YES,wx.ID_NO if ans == wx.ID_CANCEL: # print ' do not quit!' pass elif ans == wx.ID_YES: # print ' save and quit' scenario = self.get_scenario() cm.save_obj(scenario, scenario.get_rootfilepath()+'.obj', is_not_save_parent=False) self._mainframe.destroy() elif ans == wx.ID_NO: # print 'quit immediately' self._mainframe.destroy()
def save(self, filepath=None): if filepath is None: filepath = self.get_rootfilepath()+'.obj' self.set_filepath(filepath) cm.save_obj(self, filepath, is_not_save_parent=False) return filepath
def save(self, filepath=None, is_not_save_parent=True): if filepath == None: self.get_scenario().get_rootfilepath() + '.res.obj' cm.save_obj(self, filepath, is_not_save_parent=is_not_save_parent)
def save(self, filepath=None, is_not_save_parent=True): if filepath is None: self.get_scenario().get_rootfilepath()+'.res.obj' cm.save_obj(self, filepath, is_not_save_parent=is_not_save_parent)
# select plans according to last simulation results sim.import_results() # will update plan travel times virtualpop.select_plans_min_time_exec_est( fraction = fraction, c_probit = c_probit) # get plans after selection ids_plan_after = virtualpop.ids_plan[ids_pers] #print ' simstats before adding results ',len(simstats) simstats.add_results(myscenario, ids_plan_before, ids_plan_after) #print ' simstats after adding results',len(simstats) else: print ' first iteration' # select all plans with the minimum estimated time virtualpop.select_plans_min_time_est( fraction = 1.0, c_probit = c_probit_ini) # initialize and safe simulation object simstats = vpr.IterateStatistics(myscenario) cm.save_obj(simstats, filepath_simstats) # safe scenario for next step #myscenario.save(filepath) myscenario.save() # No simulation, only write configuration file .netc.xml # and SUMO command line command in cmlfilepath sim.do()