How to use the ciw.individual.Individual function in Ciw

To help you get started, we’ve selected a few Ciw examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CiwPython / Ciw / ciw / arrival_node.py View on Github external
def have_event(self):
        """
        Finds a batch size. Creates that many Individuals and send
        them to the relevent node. Then updates the event_dates_dict.
        """
        batch = self.batch_size(self.next_node, self.next_class)
        for _ in range(batch):
            self.number_of_individuals += 1
            priority_class = self.simulation.network.priority_class_mapping[
                self.next_class]
            next_individual = Individual(self.number_of_individuals,
                                         self.next_class,
                                         priority_class)
            next_individual.simulation = self.simulation
            if self.simulation.network.process_based:
                next_individual.route = self.simulation.network.customer_classes[
                next_individual.customer_class].routing[self.next_node - 1](next_individual)
            next_node = self.simulation.transitive_nodes[self.next_node - 1]
            self.release_individual(next_node, next_individual)

        self.event_dates_dict[self.next_node][
            self.next_class] = self.increment_time(
            self.event_dates_dict[self.next_node][
            self.next_class], self.inter_arrival(
            self.next_node, self.next_class))
        self.find_next_event_date()