本文整理汇总了C++中Person::cancel_all_return_to_residence_events方法的典型用法代码示例。如果您正苦于以下问题:C++ Person::cancel_all_return_to_residence_events方法的具体用法?C++ Person::cancel_all_return_to_residence_events怎么用?C++ Person::cancel_all_return_to_residence_events使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person::cancel_all_return_to_residence_events方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
void CirculateToTargetLocationNextDayEvent::execute() {
Person* person = (Person*) dispatcher();
person->set_location(target_location_);
if (target_location_ != person->residence_location()) {
//if person already have return trip then no need to reschedule it
//elase
//Schedule for a return trip in next several days base on gamma distribution
if (!person->has_return_to_residence_event()) {
int length_of_trip = 0;
while (length_of_trip < 1) {
length_of_trip = Model::RANDOM->random_gamma(Model::CONFIG->spatial_information().length_of_stay_theta, Model::CONFIG->spatial_information().length_of_stay_k);
}
// std::cout << length_of_trip << std::endl;
ReturnToResidenceEvent::schedule_event(Model::SCHEDULER, person, Model::SCHEDULER->current_time() + length_of_trip);
}
} else {
//return by chance so we cancel all return event
//cancel return trip and do nothing
person->cancel_all_return_to_residence_events();
}
}