From 06091b7565c27bdcc896af23ec03465fad1d5955 Mon Sep 17 00:00:00 2001 From: Vince Knight Date: Mon, 18 Apr 2016 16:21:04 +0100 Subject: [PATCH] Adding class for CustomerClass. --- .../29a0888f2630c3d7/2d5103d9aa08908b | Bin 32 -> 0 bytes .../29a0888f2630c3d7/3bfd3000f4d09ff0 | Bin 32 -> 0 bytes .../29a0888f2630c3d7/aeed295ab0fa36c1 | Bin 32 -> 0 bytes .../29a0888f2630c3d7/de8a847bff8c343d | Bin 32 -> 0 bytes .../a40d01c034da88b1/02848ce3c6dfca85 | Bin 32 -> 0 bytes .../a40d01c034da88b1/0adbbc0e978d87be | Bin 32 -> 0 bytes .../a40d01c034da88b1/1c20758af7e9f9a5 | Bin 32 -> 0 bytes .../a40d01c034da88b1/589cd42f92297ac4 | Bin 32 -> 0 bytes .../a40d01c034da88b1/7cc4aa8f917cbbfc | Bin 32 -> 0 bytes .../a40d01c034da88b1/94b6e6116f53a455 | Bin 32 -> 0 bytes .../a40d01c034da88b1/ae1636a12488347b | Bin 32 -> 0 bytes .../a40d01c034da88b1/c5dccddeaad3275a | Bin 32 -> 0 bytes .../a40d01c034da88b1/ecb1ac629f8d49ff | Bin 32 -> 0 bytes ciw/network.py | 18 ++++++- ciw/tests/test_network.py | 49 ++++++++++++------ 15 files changed, 51 insertions(+), 16 deletions(-) delete mode 100644 .hypothesis/examples/29a0888f2630c3d7/2d5103d9aa08908b delete mode 100644 .hypothesis/examples/29a0888f2630c3d7/3bfd3000f4d09ff0 delete mode 100644 .hypothesis/examples/29a0888f2630c3d7/aeed295ab0fa36c1 delete mode 100644 .hypothesis/examples/29a0888f2630c3d7/de8a847bff8c343d delete mode 100644 .hypothesis/examples/a40d01c034da88b1/02848ce3c6dfca85 delete mode 100644 .hypothesis/examples/a40d01c034da88b1/0adbbc0e978d87be delete mode 100644 .hypothesis/examples/a40d01c034da88b1/1c20758af7e9f9a5 delete mode 100644 .hypothesis/examples/a40d01c034da88b1/589cd42f92297ac4 delete mode 100644 .hypothesis/examples/a40d01c034da88b1/7cc4aa8f917cbbfc delete mode 100644 .hypothesis/examples/a40d01c034da88b1/94b6e6116f53a455 delete mode 100644 .hypothesis/examples/a40d01c034da88b1/ae1636a12488347b delete mode 100644 .hypothesis/examples/a40d01c034da88b1/c5dccddeaad3275a delete mode 100644 .hypothesis/examples/a40d01c034da88b1/ecb1ac629f8d49ff diff --git a/.hypothesis/examples/29a0888f2630c3d7/2d5103d9aa08908b b/.hypothesis/examples/29a0888f2630c3d7/2d5103d9aa08908b deleted file mode 100644 index 715d6d5867772c29d7e33c6cfdf09fae3d882288..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 ScmZQzzy{3Df<+k>?gIb{lL7<) diff --git a/.hypothesis/examples/29a0888f2630c3d7/3bfd3000f4d09ff0 b/.hypothesis/examples/29a0888f2630c3d7/3bfd3000f4d09ff0 deleted file mode 100644 index e3ccfb2081fec033835f717dba7887bbbc136bd0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 OcmZQzzylZ+?gIb;LID8) diff --git a/.hypothesis/examples/29a0888f2630c3d7/aeed295ab0fa36c1 b/.hypothesis/examples/29a0888f2630c3d7/aeed295ab0fa36c1 deleted file mode 100644 index c5acda467e98568ba68971bafab980a205210a70..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 XcmZQzfB^dsPzIPXI}4^5748E7CJO^I diff --git a/.hypothesis/examples/29a0888f2630c3d7/de8a847bff8c343d b/.hypothesis/examples/29a0888f2630c3d7/de8a847bff8c343d deleted file mode 100644 index 4e4e4935707a596987ec1cc32e3d0d587dbe4f04..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 KcmZQzzz+ZbAOHaX diff --git a/.hypothesis/examples/a40d01c034da88b1/02848ce3c6dfca85 b/.hypothesis/examples/a40d01c034da88b1/02848ce3c6dfca85 deleted file mode 100644 index 216ffd40a9f628a20d80e7abfd85db14cd075f82..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 XcmcEDIdkUB{|>?p3@Cup9x4t1m4yhj diff --git a/.hypothesis/examples/a40d01c034da88b1/0adbbc0e978d87be b/.hypothesis/examples/a40d01c034da88b1/0adbbc0e978d87be deleted file mode 100644 index a208c5678c353f48fb479392c917a54e5f22a0a0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 VcmcEDITHx}3pX&J08V?TH~^k?31$EQ diff --git a/.hypothesis/examples/a40d01c034da88b1/1c20758af7e9f9a5 b/.hypothesis/examples/a40d01c034da88b1/1c20758af7e9f9a5 deleted file mode 100644 index a8bebd42e03cb0314f9b9d5c1e40bdd2e78ac580..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 VcmcED&*T6E!VL^4fYTl-4ggcx1h4=A diff --git a/.hypothesis/examples/a40d01c034da88b1/589cd42f92297ac4 b/.hypothesis/examples/a40d01c034da88b1/589cd42f92297ac4 deleted file mode 100644 index 5c4ea557eb47233f37a7948de14e168ca79e6a8c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 VcmcEDITHx>3pX&J08V?TH~^P*2<89) diff --git a/.hypothesis/examples/a40d01c034da88b1/7cc4aa8f917cbbfc b/.hypothesis/examples/a40d01c034da88b1/7cc4aa8f917cbbfc deleted file mode 100644 index 12292133bd44cf24d0328bef75cb7cff63e14ce9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 VcmcEj&*T6E!VL^4fYTl-4gg(Q1uy^r diff --git a/.hypothesis/examples/a40d01c034da88b1/94b6e6116f53a455 b/.hypothesis/examples/a40d01c034da88b1/94b6e6116f53a455 deleted file mode 100644 index 591a2fae797e0aef0af75677cb00ac9b11021cdb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 UcmcEDITHl_H!z?8PJ5_00INj`asU7T diff --git a/.hypothesis/examples/a40d01c034da88b1/ae1636a12488347b b/.hypothesis/examples/a40d01c034da88b1/ae1636a12488347b deleted file mode 100644 index 347ea0aaa7c379d48386a7e663dbe892cd9970e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 VcmcED`QHHugc}%80H-}v8~}ES2A%)_ diff --git a/.hypothesis/examples/a40d01c034da88b1/c5dccddeaad3275a b/.hypothesis/examples/a40d01c034da88b1/c5dccddeaad3275a deleted file mode 100644 index dab1845195ad6b74f237d62de575faf873a63b32..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 XcmcEDIdkTI2M6H>1{A<)4;2RhgX0H+ diff --git a/.hypothesis/examples/a40d01c034da88b1/ecb1ac629f8d49ff b/.hypothesis/examples/a40d01c034da88b1/ecb1ac629f8d49ff deleted file mode 100644 index 1927d3fb299a35927aefff667a621ac5b129e6fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 XcmcEDIdkUB{SLwn3@Cup9x4t1js*xb diff --git a/ciw/network.py b/ciw/network.py index 4601c921..a3cec2a5 100644 --- a/ciw/network.py +++ b/ciw/network.py @@ -13,4 +13,20 @@ def __init__(self, self.number_of_servers = number_of_servers self.queueing_capacity = queueing_capacity self.class_change_matrix = class_change_matrix - self.schedule = schedule \ No newline at end of file + self.schedule = schedule + + +class CustomerClass: + """ + An information store for each customer class in the queueing network + """ + def __init__(self, + arrival_distributions, + service_distributions, + transition_matrix): + """ + Initialises the CutomerCass object + """ + self.arrival_distributions = arrival_distributions + self.service_distributions = service_distributions + self.transition_matrix = transition_matrix diff --git a/ciw/tests/test_network.py b/ciw/tests/test_network.py index 91ca185e..46de39b9 100644 --- a/ciw/tests/test_network.py +++ b/ciw/tests/test_network.py @@ -7,15 +7,15 @@ class TestServiceCentre(unittest.TestCase): 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 + 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) + 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) @@ -26,14 +26,33 @@ def test_init_method(self): class_change_prob1=floats(min_value=0.0, max_value=1.0), class_change_prob2=floats(min_value=0.0, max_value=1.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 + 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) + 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) \ No newline at end of file + self.assertEqual(SC.schedule, schedule) + + +class TestCustomerClass(unittest.TestCase): + + def test_init_method(self): + arrival_distributions = [["Uniform", 4.0, 9.0], + ["Exponential", 5], + ["Gamma", 0.6, 1.2]] + service_distributions = [["Gamma", 4.0, 9.0], + ["Uniform", 0.6, 1.2], + ["Exponential", 5]] + transition_matrix = [[.2, .6, .2], [0, 0, 0], [.5, 0, 0]] + + CC = ciw.CustomerClass(arrival_distributions, + service_distributions, + transition_matrix) + self.assertEqual(CC.arrival_distributions, arrival_distributions) + self.assertEqual(CC.service_distributions, service_distributions) + self.assertEqual(CC.transition_matrix, transition_matrix)