本文整理汇总了Python中problem.Problem.simulate方法的典型用法代码示例。如果您正苦于以下问题:Python Problem.simulate方法的具体用法?Python Problem.simulate怎么用?Python Problem.simulate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类problem.Problem
的用法示例。
在下文中一共展示了Problem.simulate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: simulate
# 需要导入模块: from problem import Problem [as 别名]
# 或者: from problem.Problem import simulate [as 别名]
def simulate(self, current_time, simulation_time, sample_time):
horizon_time = self.options['horizon_time']
if self.init_time is None:
rel_current_time = np.round(current_time-self.start_time, 6) % self.knot_time
else:
rel_current_time = self.init_time
if horizon_time - rel_current_time < simulation_time:
simulation_time = horizon_time - rel_current_time
self.compute_partial_objective(current_time, simulation_time)
Problem.simulate(self, current_time, simulation_time, sample_time)
示例2: simulate
# 需要导入模块: from problem import Problem [as 别名]
# 或者: from problem.Problem import simulate [as 别名]
def simulate(self, current_time, simulation_time, sample_time):
# save global path and frame border
# store trajectories
if not hasattr(self, 'frame_storage'):
self.frame_storage = []
self.global_path_storage = []
if simulation_time == np.inf:
# using simulator.run_once()
simulation_time = sum(self.motion_times)
repeat = int(simulation_time/sample_time)
# copy frames, to avoid problems when removing elements from self.frames
frames_to_save = self.frames[:]
for k in range(repeat):
self._add_to_memory(self.frame_storage, frames_to_save)
self._add_to_memory(self.global_path_storage, self.global_path, repeat)
# simulate the multiframe problem
Problem.simulate(self, current_time, simulation_time, sample_time)