Example #1
0
 def test_init_method(self):
     number_of_servers = 2
     queueing_capacity = 'Inf'
     schedule = None
     class_change_matrix = [[0.2, 0.8], [1.0, 0.0]]
     arrival_distributions = [["Uniform", 4.0, 9.0], ["Exponential", 5.0],
                              ["Gamma", 0.6, 1.2]]
     service_distributions = [["Gamma", 4.0, 9.0], ["Uniform", 0.6, 1.2],
                              ["Exponential", 5]]
     transition_matrix = [[0.2, 0.6, 0.2], [0.0, 0.0, 0.0], [0.5, 0.0, 0.0]]
     priority_class = 0
     batching_distributions = [['Deterministic', 1], ['Deterministic', 1],
                               ['Deterministic', 1]]
     baulking_functions = [None, None, example_baulking_function]
     service_centres = [
         ciw.ServiceCentre(number_of_servers, queueing_capacity,
                           class_change_matrix, schedule) for i in range(4)
     ]
     customer_classes = [
         ciw.CustomerClass(arrival_distributions, service_distributions,
                           transition_matrix, priority_class,
                           baulking_functions, batching_distributions)
         for i in range(2)
     ]
     N = ciw.Network(service_centres, customer_classes)
     self.assertEqual(N.service_centres, service_centres)
     self.assertEqual(N.customer_classes, customer_classes)
     self.assertEqual(N.number_of_nodes, 4)
     self.assertEqual(N.number_of_classes, 2)
     self.assertEqual(N.number_of_priority_classes, 1)
     self.assertEqual(N.priority_class_mapping, {0: 0, 1: 0})
Example #2
0
 def test_init_method(self):
     number_of_servers = 2
     queueing_capacity = 'Inf'
     class_change_matrix = [[0.2, 0.8],
                            [1.0, 0.0]]
     schedule = None
     SC = ciw.ServiceCentre(number_of_servers, queueing_capacity, class_change_matrix, schedule)
     self.assertEqual(SC.number_of_servers, number_of_servers)
     self.assertEqual(SC.queueing_capacity, queueing_capacity)
     self.assertEqual(SC.class_change_matrix, class_change_matrix)
     self.assertEqual(SC.schedule, schedule)
Example #3
0
 def test_init_method_h(self, number_of_servers, queueing_capacity, class_change_prob1, class_change_prob2):
     class_change_matrix = [[class_change_prob1,
                             1 - class_change_prob1],
                            [class_change_prob2,
                             1 - class_change_prob2]]
     schedule = None
     SC = ciw.ServiceCentre(number_of_servers, queueing_capacity, class_change_matrix, schedule)
     self.assertEqual(SC.number_of_servers, number_of_servers)
     self.assertEqual(SC.queueing_capacity, queueing_capacity)
     self.assertEqual(SC.class_change_matrix, class_change_matrix)
     self.assertEqual(SC.schedule, schedule)
Example #4
0
 def test_init_method(self):
     number_of_servers = 2
     queueing_capacity = float('inf')
     schedule = None
     class_change_matrix = [[0.2, 0.8], [1.0, 0.0]]
     arrival_distributions = [
         ciw.dists.Uniform(4.0, 9.0),
         ciw.dists.Exponential(5.0),
         ciw.dists.Gamma(0.6, 1.2)
     ]
     service_distributions = [
         ciw.dists.Gamma(4.0, 9.0),
         ciw.dists.Uniform(0.6, 1.2),
         ciw.dists.Exponential(5)
     ]
     routing = [[0.2, 0.6, 0.2], [0.0, 0.0, 0.0], [0.5, 0.0, 0.0]]
     priority_class = 0
     batching_distributions = [
         ciw.dists.Deterministic(1),
         ciw.dists.Deterministic(1),
         ciw.dists.Deterministic(1)
     ]
     baulking_functions = [None, None, example_baulking_function]
     reneging_time_distributions = [None, None, None]
     reneging_destinations = [-1, -1, -1]
     class_change_time_distributions = [None, None]
     service_centres = [
         ciw.ServiceCentre(number_of_servers, queueing_capacity,
                           class_change_matrix, schedule) for i in range(3)
     ]
     customer_classes = [
         ciw.CustomerClass(arrival_distributions, service_distributions,
                           routing, priority_class, baulking_functions,
                           batching_distributions,
                           reneging_time_distributions,
                           reneging_destinations,
                           class_change_time_distributions)
         for i in range(2)
     ]
     N = ciw.Network(service_centres, customer_classes)
     self.assertEqual(N.service_centres, service_centres)
     self.assertEqual(N.customer_classes, customer_classes)
     self.assertEqual(N.number_of_nodes, 3)
     self.assertEqual(N.number_of_classes, 2)
     self.assertEqual(N.number_of_priority_classes, 1)
     self.assertEqual(N.priority_class_mapping, {0: 0, 1: 0})
     self.assertFalse(N.service_centres[0].reneging)
     self.assertFalse(N.service_centres[1].reneging)
     self.assertFalse(N.service_centres[0].class_change_time)
     self.assertFalse(N.service_centres[1].class_change_time)