From 95ac4c5082c21f104fdaf9b7413659b68c0cb741 Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Fri, 8 Apr 2016 15:34:48 +0100 Subject: [PATCH 01/20] modularise deadlock detection mechanism --- .../3a76e75eadfd834a/ac569ea775eac75b | Bin 0 -> 41 bytes .../2135bf6f68d836d2/034b25e396cc3f0d | Bin 0 -> 32 bytes .../2135bf6f68d836d2/0c7658a22232bd18 | Bin 0 -> 32 bytes .../2135bf6f68d836d2/10a299eedbad2c49 | Bin 0 -> 32 bytes .../2135bf6f68d836d2/11f0ea6ee01ff827 | Bin 0 -> 32 bytes .../2135bf6f68d836d2/280ada4c557ef01f | Bin 0 -> 32 bytes .../2135bf6f68d836d2/39328dbfe8a7fb12 | Bin 0 -> 32 bytes .../2135bf6f68d836d2/39582d72ae322f61 | Bin 0 -> 32 bytes .../2135bf6f68d836d2/3c85f46a982523f2 | Bin 0 -> 32 bytes .../2135bf6f68d836d2/60aa6060868cc0d6 | Bin 0 -> 32 bytes .../2135bf6f68d836d2/643053a637c389f4 | Bin 0 -> 32 bytes .../2135bf6f68d836d2/65c46e75b9714bfa | Bin 0 -> 32 bytes .../2135bf6f68d836d2/70a3018b9dea89e3 | Bin 0 -> 32 bytes .../2135bf6f68d836d2/7cc6c2c7e7ef3196 | Bin 0 -> 32 bytes .../2135bf6f68d836d2/81dfa35ddce51eb5 | Bin 0 -> 32 bytes .../2135bf6f68d836d2/8975c37d2560face | Bin 0 -> 32 bytes .../2135bf6f68d836d2/928ffeb4ea6014f9 | Bin 0 -> 32 bytes .../2135bf6f68d836d2/c42343d5a52b6b7d | Bin 0 -> 32 bytes .../2135bf6f68d836d2/d1341e1832d26a93 | Bin 0 -> 32 bytes .../2135bf6f68d836d2/eac03c7087c8e5dc | Bin 0 -> 32 bytes .../2135bf6f68d836d2/f3d0484011fc8072 | Bin 0 -> 32 bytes .../29d64452f36fbdaf/07f40331c2259991 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/0bfcf1c1a8f79903 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/0f45b4f89ac24914 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/1055f48919b36f33 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/122242e9102ae91b | Bin 0 -> 41 bytes .../29d64452f36fbdaf/22498c907cff6255 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/2cdf22b064d590ca | Bin 0 -> 41 bytes .../29d64452f36fbdaf/3b2527623764bb0c | Bin 0 -> 41 bytes .../29d64452f36fbdaf/3d38aa5af9ec8d22 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/3f120337cce47948 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/43e4dd3cf9d64262 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/4576b9dc91571a03 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/57c835fa3a40c7be | Bin 0 -> 41 bytes .../29d64452f36fbdaf/5ac90a62cd2d0b69 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/5c57f5f7435178e2 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/63aaa5f14b83350b | Bin 0 -> 41 bytes .../29d64452f36fbdaf/663509dcd6f64d9e | Bin 0 -> 41 bytes .../29d64452f36fbdaf/67b93f852bbeb03b | Bin 0 -> 41 bytes .../29d64452f36fbdaf/6be26f5cb9a2c0ab | Bin 0 -> 41 bytes .../29d64452f36fbdaf/72c174b8feaa0c36 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/76cfd55801974d94 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/7946df86e6703f4e | Bin 0 -> 41 bytes .../29d64452f36fbdaf/7b9a60dbb99b9c33 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/83cba6a87fd0c85a | Bin 0 -> 41 bytes .../29d64452f36fbdaf/8597d3914015f19c | Bin 0 -> 41 bytes .../29d64452f36fbdaf/9bab9a947e0c871b | Bin 0 -> 41 bytes .../29d64452f36fbdaf/a65199641d904138 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/a7ef7f837f3956ed | Bin 0 -> 41 bytes .../29d64452f36fbdaf/aad72d7cff4c7d1a | Bin 0 -> 41 bytes .../29d64452f36fbdaf/ac569ea775eac75b | Bin 0 -> 41 bytes .../29d64452f36fbdaf/b4f767c02f877c4d | Bin 0 -> 41 bytes .../29d64452f36fbdaf/befb43ad3a3d52eb | Bin 0 -> 41 bytes .../29d64452f36fbdaf/bf76ae898da72578 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/cdeb5699b25c89ae | Bin 0 -> 41 bytes .../29d64452f36fbdaf/ce408bd66e07df31 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/d0eedfe923594419 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/d16c9ac675f0224a | Bin 0 -> 41 bytes .../29d64452f36fbdaf/dddff10eff3de080 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/df8302c6c567f205 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/e971ec0c42dafad6 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/f89a5e9b29fb0981 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/fb17b4ef55e73ff1 | Bin 0 -> 41 bytes .../29d64452f36fbdaf/fc538629f5460a21 | Bin 0 -> 41 bytes .../377a0dd4811fba04/0c68cc8d7c2faa3a | Bin 0 -> 40 bytes .../377a0dd4811fba04/2aa8bf5054776e2d | Bin 0 -> 40 bytes .../377a0dd4811fba04/2b59f590de4f56c6 | Bin 0 -> 40 bytes .../377a0dd4811fba04/31fcde061fbf718e | Bin 0 -> 40 bytes .../377a0dd4811fba04/3e4ee714c0f29721 | Bin 0 -> 40 bytes .../377a0dd4811fba04/4089e312182cc8e7 | Bin 0 -> 40 bytes .../377a0dd4811fba04/474b4b9a5cd00cce | Bin 0 -> 40 bytes .../377a0dd4811fba04/4e64759a3832e641 | Bin 0 -> 40 bytes .../377a0dd4811fba04/5ee4626988dce731 | Bin 0 -> 40 bytes .../377a0dd4811fba04/634d8517fbda46d0 | Bin 0 -> 40 bytes .../377a0dd4811fba04/7addb7533cee8d9b | Bin 0 -> 40 bytes .../377a0dd4811fba04/9b1fa05eb3cfbd5c | Bin 0 -> 40 bytes .../377a0dd4811fba04/b55807bf10571b2b | Bin 0 -> 40 bytes .../377a0dd4811fba04/c31a9ca6bff3b4ec | Bin 0 -> 40 bytes .../377a0dd4811fba04/d3b84c2b8daf4b81 | Bin 0 -> 40 bytes .../377a0dd4811fba04/d642a71473e62200 | Bin 0 -> 40 bytes .../377a0dd4811fba04/dd081cb25a7a8b67 | Bin 0 -> 40 bytes .../377a0dd4811fba04/ddf119247b4aca3f | Bin 0 -> 40 bytes .../377a0dd4811fba04/ecd5d83f24df8ea6 | Bin 0 -> 40 bytes .../377a0dd4811fba04/f5328cc719115bd6 | Bin 0 -> 40 bytes .../377a0dd4811fba04/fa52af9de5887c33 | Bin 0 -> 40 bytes .../3a76e75eadfd834a/05e0e870e22f368f | Bin 0 -> 41 bytes .../3a76e75eadfd834a/138f4155c3c5fd55 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/3b192e19e5b57b22 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/3b2527623764bb0c | Bin 0 -> 41 bytes .../3a76e75eadfd834a/3d38aa5af9ec8d22 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/41340a27761fc1ee | Bin 0 -> 41 bytes .../3a76e75eadfd834a/43f1b35e185d76b3 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/44486db86cb11664 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/447101682c49d83c | Bin 0 -> 41 bytes .../3a76e75eadfd834a/4576b9dc91571a03 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/571a6b9cae7746ab | Bin 0 -> 41 bytes .../3a76e75eadfd834a/5c57f5f7435178e2 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/62f835dc6d94a701 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/63aaa5f14b83350b | Bin 0 -> 41 bytes .../3a76e75eadfd834a/63be77937c3437fb | Bin 0 -> 41 bytes .../3a76e75eadfd834a/6be26f5cb9a2c0ab | Bin 0 -> 41 bytes .../3a76e75eadfd834a/734fc3cad67bae63 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/76cfd55801974d94 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/7946df86e6703f4e | Bin 0 -> 41 bytes .../3a76e75eadfd834a/7b9a60dbb99b9c33 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/8038403e33dbdc33 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/914e9a698e01dafd | Bin 0 -> 41 bytes .../3a76e75eadfd834a/948c69a015222d1b | Bin 0 -> 41 bytes .../3a76e75eadfd834a/9b06d71d989a59bf | Bin 0 -> 41 bytes .../3a76e75eadfd834a/a292dce0d8772b0c | Bin 0 -> 41 bytes .../3a76e75eadfd834a/ac569ea775eac75b | Bin 0 -> 41 bytes .../3a76e75eadfd834a/baa66fafcc3fe3ca | Bin 0 -> 41 bytes .../3a76e75eadfd834a/befb43ad3a3d52eb | Bin 0 -> 41 bytes .../3a76e75eadfd834a/bf76ae898da72578 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/c389f4dead366e47 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/c6610b476a7ec7bc | Bin 0 -> 41 bytes .../3a76e75eadfd834a/cd5bb8f67cd3ecf2 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/ce408bd66e07df31 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/da214baba10761e0 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/db9b9b85ce11448d | Bin 0 -> 41 bytes .../3a76e75eadfd834a/dc8c2cadd174e8bb | Bin 0 -> 41 bytes .../3a76e75eadfd834a/de13e4dcb15227d8 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/e5e827fb49bb3743 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/eb1a640421daa788 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/f73017c6a181c088 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/f89a5e9b29fb0981 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/fc538629f5460a21 | Bin 0 -> 41 bytes .../3a76e75eadfd834a/fedbd61fbad0a7a8 | Bin 0 -> 41 bytes .../69ab7130ae480724/1b24950b35f29d6f | Bin 0 -> 32 bytes .../69ab7130ae480724/30489ccb7a447d7c | Bin 0 -> 32 bytes .../69ab7130ae480724/6f5a1b20f7726104 | Bin 0 -> 32 bytes .../69ab7130ae480724/93e8767cb804d887 | Bin 0 -> 32 bytes .../69ab7130ae480724/9cdc7593276f757f | Bin 0 -> 32 bytes .../69ab7130ae480724/a105af65d5b4b660 | Bin 0 -> 32 bytes .../69ab7130ae480724/d1a76c372251fd27 | Bin 0 -> 32 bytes .../69ab7130ae480724/e7d363ef91203276 | Bin 0 -> 32 bytes .../69ab7130ae480724/ffe961fa96847bc4 | Bin 0 -> 32 bytes .../8c8860643dae35d1/6de690448c449507 | Bin 0 -> 24 bytes .../8c8860643dae35d1/d3399b7262fb56cb | Bin 0 -> 24 bytes .../8f69b08f1956c2f7/17e7f21a2c8ef40f | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/1c43dc8de6f02601 | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/252b611bdb919e2d | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/33aab90d29084756 | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/382ac23a6bc6ea99 | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/3e65b4d379f37bca | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/3fe4b13f2d35df34 | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/413f43e0266269ed | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/4514052d819dc1a3 | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/60c09324887da01b | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/8de08614d440e1ba | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/a0c3b1b68de2d4bd | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/ab5f6935103030fb | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/ac5be3b02f0e8fd6 | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/b1b33a7a1346a013 | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/b599f5378698ac2c | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/c665ae7d6adb0d2a | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/d4f90af82fb4dcb2 | Bin 0 -> 32 bytes .../8f69b08f1956c2f7/f019fc978a91b344 | Bin 0 -> 32 bytes .../a40d01c034da88b1/0f910c795309b46f | Bin 0 -> 40 bytes .../a40d01c034da88b1/1c0cf4c5a5fb1226 | Bin 0 -> 40 bytes .../a40d01c034da88b1/1c3c5a498b8754a0 | Bin 0 -> 40 bytes .../a40d01c034da88b1/2469456be6b9deba | Bin 0 -> 40 bytes .../a40d01c034da88b1/2626b3797e2d0970 | Bin 0 -> 40 bytes .../a40d01c034da88b1/274f542c0a374f79 | Bin 0 -> 40 bytes .../a40d01c034da88b1/27ea110ec6978fc9 | Bin 0 -> 40 bytes .../a40d01c034da88b1/28c49ea88b21b4bb | Bin 0 -> 40 bytes .../a40d01c034da88b1/3482c8bfece70225 | Bin 0 -> 40 bytes .../a40d01c034da88b1/3a518690382fbcbc | Bin 0 -> 40 bytes .../a40d01c034da88b1/406c004fa66bd45d | Bin 0 -> 40 bytes .../a40d01c034da88b1/46fca603494c30a0 | Bin 0 -> 40 bytes .../a40d01c034da88b1/49225726976757b5 | Bin 0 -> 40 bytes .../a40d01c034da88b1/4d614399be03eb33 | Bin 0 -> 40 bytes .../a40d01c034da88b1/56c9d45c6c14bf73 | Bin 0 -> 40 bytes .../a40d01c034da88b1/5f3e5a80acb61799 | Bin 0 -> 40 bytes .../a40d01c034da88b1/6510dc8ddd11d095 | Bin 0 -> 40 bytes .../a40d01c034da88b1/65e3b4ebea18d3cb | Bin 0 -> 40 bytes .../a40d01c034da88b1/6dbd341a6c17e89a | Bin 0 -> 40 bytes .../a40d01c034da88b1/70513ceef60a7920 | Bin 0 -> 40 bytes .../a40d01c034da88b1/73c7c8f251a560bb | Bin 0 -> 40 bytes .../a40d01c034da88b1/85c89acff90010cb | Bin 0 -> 40 bytes .../a40d01c034da88b1/86f8a2adee4579b7 | Bin 0 -> 40 bytes .../a40d01c034da88b1/880731d44169d3f1 | Bin 0 -> 40 bytes .../a40d01c034da88b1/884f3914d1cffa77 | Bin 0 -> 40 bytes .../a40d01c034da88b1/8d79a944b59a71be | Bin 0 -> 40 bytes .../a40d01c034da88b1/a69fadadd03f3f79 | Bin 0 -> 40 bytes .../a40d01c034da88b1/a6e7c35e074fde76 | Bin 0 -> 40 bytes .../a40d01c034da88b1/ab5a95af6472ebcd | Bin 0 -> 40 bytes .../a40d01c034da88b1/abe180733b21a3c1 | Bin 0 -> 40 bytes .../a40d01c034da88b1/b20e8032b2c91fe1 | Bin 0 -> 40 bytes .../a40d01c034da88b1/b7009287b23d0685 | Bin 0 -> 40 bytes .../a40d01c034da88b1/c2865d21e13c5816 | Bin 0 -> 40 bytes .../a40d01c034da88b1/c3dccc25b1dc0fa3 | Bin 0 -> 40 bytes .../a40d01c034da88b1/c5327d1b65f122a9 | Bin 0 -> 40 bytes .../a40d01c034da88b1/c79fcd445f67f1cc | Bin 0 -> 40 bytes .../a40d01c034da88b1/cd232c37fc5e059c | Bin 0 -> 40 bytes .../a40d01c034da88b1/dadcabc3cd12e89f | Bin 0 -> 40 bytes .../a40d01c034da88b1/dfbb200b6fb9e974 | Bin 0 -> 40 bytes .../a40d01c034da88b1/e303988855ce4704 | Bin 0 -> 40 bytes .../a40d01c034da88b1/e9713268c587a303 | Bin 0 -> 40 bytes .../a40d01c034da88b1/f207074e4dc8c0c3 | Bin 0 -> 40 bytes .../c105d3723925d8e5/0073662f6ce0c7b3 | Bin 0 -> 42 bytes .../c105d3723925d8e5/0278ab1971aed195 | Bin 0 -> 42 bytes .../c105d3723925d8e5/0d8bfc746159449b | Bin 0 -> 123 bytes .../c105d3723925d8e5/0fd8474e4914135c | Bin 0 -> 42 bytes .../c105d3723925d8e5/25d5b9279b919aa9 | Bin 0 -> 42 bytes .../c105d3723925d8e5/2a5f989d9f086c26 | Bin 0 -> 42 bytes .../c105d3723925d8e5/2c50eb089aad0c9a | Bin 0 -> 105 bytes .../c105d3723925d8e5/33eaae48604249fe | Bin 0 -> 42 bytes .../c105d3723925d8e5/379635829c16b65d | Bin 0 -> 42 bytes .../c105d3723925d8e5/37f1bb9145de649c | Bin 0 -> 42 bytes .../c105d3723925d8e5/42fd038c68db876d | Bin 0 -> 42 bytes .../c105d3723925d8e5/4573964e3d9a89b7 | Bin 0 -> 87 bytes .../c105d3723925d8e5/465fe65d86537e10 | Bin 0 -> 42 bytes .../c105d3723925d8e5/544a97521b7cf469 | Bin 0 -> 51 bytes .../c105d3723925d8e5/566872ef33ff7c96 | Bin 0 -> 42 bytes .../c105d3723925d8e5/5765a394e06bc2d1 | Bin 0 -> 42 bytes .../c105d3723925d8e5/5e2d3d6ee09a381a | Bin 0 -> 42 bytes .../c105d3723925d8e5/67cd259f7ee34827 | Bin 0 -> 42 bytes .../c105d3723925d8e5/739ba048e2d61501 | Bin 0 -> 42 bytes .../c105d3723925d8e5/73f1bade3ff1b207 | Bin 0 -> 42 bytes .../c105d3723925d8e5/7d331bba524859f3 | Bin 0 -> 42 bytes .../c105d3723925d8e5/863788abf4d4a9f9 | Bin 0 -> 42 bytes .../c105d3723925d8e5/9aed3ab26f49aecf | Bin 0 -> 42 bytes .../c105d3723925d8e5/9b9253615e268fb3 | Bin 0 -> 42 bytes .../c105d3723925d8e5/9f47c80709ddbdab | Bin 0 -> 42 bytes .../c105d3723925d8e5/a03b8168d51f08b8 | Bin 0 -> 42 bytes .../c105d3723925d8e5/a187b14d402a5dd7 | Bin 0 -> 42 bytes .../c105d3723925d8e5/a309b7dadbd46083 | Bin 0 -> 42 bytes .../c105d3723925d8e5/a4bcc319ef6f4958 | Bin 0 -> 42 bytes .../c105d3723925d8e5/a55ccd0730899da4 | Bin 0 -> 141 bytes .../c105d3723925d8e5/aae8f6f1a01d193f | Bin 0 -> 42 bytes .../c105d3723925d8e5/b1508d25aa9a5aa5 | Bin 0 -> 42 bytes .../c105d3723925d8e5/b80aa24bf5892ac2 | Bin 0 -> 42 bytes .../c105d3723925d8e5/c7b007fdd372488e | Bin 0 -> 42 bytes .../c105d3723925d8e5/df81bc0733581adf | Bin 0 -> 42 bytes .../c105d3723925d8e5/e1bee70c82463f7b | Bin 0 -> 42 bytes .../c105d3723925d8e5/e5814487960bcb85 | Bin 0 -> 69 bytes .../c105d3723925d8e5/ff6d287ef876de5d | Bin 0 -> 42 bytes .../c6ec2939c8e3de8f/0c146bbc7b68dc4a | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/223a3b1db81ce7d2 | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/3719655d41b583a0 | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/38fd35f4f2c4dd8e | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/458f7a0e94240493 | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/4d92c7ed2572b2d4 | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/5c626841645613a4 | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/5f4eac4adea057eb | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/73c0e5297fac3b5d | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/7c34c6a23fd87b43 | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/90cd1afcfb4f3c6e | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/a602ca47fdeed33b | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/b124a569a948fbbe | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/bc33fbaa46b1daf6 | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/c2453768f30f6d11 | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/d4a459102fced1bd | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/e717a6a4a1f1e0ad | Bin 0 -> 24 bytes .../c6ec2939c8e3de8f/ee677f65e88474d6 | Bin 0 -> 24 bytes .../eceffc5f24ea1d52/023e7f04f209194f | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/02ac26433f766cb2 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/0abbde7f77ba6bc4 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/0ee62aee8bf00ed1 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/103311af0e5eb240 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/1a69ba3189259619 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/31216203baeacbf6 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/31aea806ecb09f13 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/4df018352a9a87b0 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/6143e3da447f9493 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/6334e2705629a7dd | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/68c58484bcab2e70 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/6d2a861a27deffa5 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/70ee306bd3759b75 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/76633c3dec6c9973 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/781e20e099c7133c | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/78b84a6c280367e5 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/7b428e48efe8090e | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/7fc631ed0409267c | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/862bf8ee7fa76bfd | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/8fcdf0ad0a8920ca | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/9f6e247174433fa2 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/ad9c8d3cc9fe097a | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/b6842be4fcffa95d | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/b6c0f9a044433f07 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/c1f56dd2207339a5 | Bin 0 -> 51 bytes .../eceffc5f24ea1d52/c70d2be73050fa02 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/d372c23b434f3511 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/e08f94226d456a59 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/e98d6873301e8acd | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/ebeb40998926966a | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/ec03f7857e8c4acb | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/f84b4e9a724e4610 | Bin 0 -> 33 bytes .../eceffc5f24ea1d52/f98d074efc56f20e | Bin 0 -> 33 bytes .../f0a58a77bff18489/22316dca9fd4df01 | Bin 0 -> 32 bytes .../f0a58a77bff18489/33d10e847e3f63c9 | Bin 0 -> 32 bytes .../f0a58a77bff18489/366feeaafbca4d07 | Bin 0 -> 32 bytes .../f0a58a77bff18489/4a9a5c3e5c6ed79f | Bin 0 -> 32 bytes .../f0a58a77bff18489/4acfd1165465e1a2 | Bin 0 -> 32 bytes .../f0a58a77bff18489/4cb46ee91acb4921 | Bin 0 -> 32 bytes .../f0a58a77bff18489/5b3cd78eceb2fd76 | Bin 0 -> 32 bytes .../f0a58a77bff18489/68c2a79f78307c34 | Bin 0 -> 32 bytes .../f0a58a77bff18489/804f0714ecd02a62 | Bin 0 -> 32 bytes .../f0a58a77bff18489/85464b03d87ac4c4 | Bin 0 -> 32 bytes .../f0a58a77bff18489/941ae18058fd462d | Bin 0 -> 32 bytes .../f0a58a77bff18489/94b7bef8231ee172 | Bin 0 -> 32 bytes .../f0a58a77bff18489/9578cd0b40d1b09e | Bin 0 -> 32 bytes .../f0a58a77bff18489/c3ea47a200e66754 | Bin 0 -> 32 bytes .../f0a58a77bff18489/d646d4d128ab236a | Bin 0 -> 32 bytes .../f0a58a77bff18489/d7c95c90e2ebd646 | Bin 0 -> 32 bytes .../fabf589bf8d75544/08ebc83e97bd1ed2 | Bin 0 -> 34 bytes .../fabf589bf8d75544/17be08cd1ff82c37 | Bin 0 -> 43 bytes .../fabf589bf8d75544/1e1066be39d3eb9f | Bin 0 -> 34 bytes .../fabf589bf8d75544/23db1f440b4bbece | Bin 0 -> 34 bytes .../fabf589bf8d75544/248007df535b4719 | Bin 0 -> 34 bytes .../fabf589bf8d75544/31cd3f2a0f974e08 | Bin 0 -> 34 bytes .../fabf589bf8d75544/3fd4d7a247d2d077 | Bin 0 -> 34 bytes .../fabf589bf8d75544/509e41f7176fff06 | Bin 0 -> 34 bytes .../fabf589bf8d75544/59bffa4336791568 | Bin 0 -> 34 bytes .../fabf589bf8d75544/60a4ca8c7a2a550e | Bin 0 -> 34 bytes .../fabf589bf8d75544/6767f5f2e8d234d9 | Bin 0 -> 34 bytes .../fabf589bf8d75544/67d47a0f45f006c4 | Bin 0 -> 34 bytes .../fabf589bf8d75544/690dca1ff62134d6 | Bin 0 -> 34 bytes .../fabf589bf8d75544/6a57639aaaea62ab | Bin 0 -> 34 bytes .../fabf589bf8d75544/782953ff5c10eb87 | Bin 0 -> 34 bytes .../fabf589bf8d75544/7e2c97b163bd804e | Bin 0 -> 61 bytes .../fabf589bf8d75544/8293554d7ebef188 | Bin 0 -> 34 bytes .../fabf589bf8d75544/af69ac820c3d205f | Bin 0 -> 34 bytes .../fabf589bf8d75544/afbedf2e052c4cec | Bin 0 -> 34 bytes .../fabf589bf8d75544/e46170106a639a5f | Bin 0 -> 34 bytes .../fabf589bf8d75544/fba965b3ca7332ee | Bin 0 -> 34 bytes .../ff07599ee3bc5e8c/081588724373035b | Bin 0 -> 35 bytes .../ff07599ee3bc5e8c/22a469db02ae65e8 | Bin 0 -> 35 bytes .../ff07599ee3bc5e8c/2712a269a6e28775 | Bin 0 -> 35 bytes .../ff07599ee3bc5e8c/2fbbe9f08c1f9169 | Bin 0 -> 35 bytes .../ff07599ee3bc5e8c/5aa9500193e6d9de | Bin 0 -> 35 bytes .../ff07599ee3bc5e8c/85fc26a24324319d | Bin 0 -> 35 bytes .../ff07599ee3bc5e8c/8d97af2e6e694866 | Bin 0 -> 35 bytes .../ff07599ee3bc5e8c/9550af14fce513a8 | Bin 0 -> 35 bytes .../ff07599ee3bc5e8c/aae7ac2630134705 | Bin 0 -> 35 bytes .../ff07599ee3bc5e8c/b5ef9d3c76060589 | Bin 0 -> 35 bytes .../ff07599ee3bc5e8c/bc90e16f5be13edf | Bin 0 -> 44 bytes .../ff07599ee3bc5e8c/f22fd856918a8920 | Bin 0 -> 35 bytes .../ff07599ee3bc5e8c/f4a9253917a99e1d | Bin 0 -> 35 bytes .../ff07599ee3bc5e8c/ff0449788b65defd | Bin 0 -> 35 bytes .../unicodedata/5.2.0/charmap.pickle.gz | Bin 0 -> 16878 bytes ciw/deadlock_detector.py | 116 ++++++++++++++++++ ciw/node.py | 30 ++--- ciw/simulation.py | 44 +++---- .../logs_test_for_deadlock_sim/parameters.yml | 2 +- ciw/tests/test_node.py | 8 +- ciw/tests/test_simulation.py | 30 +++-- 348 files changed, 159 insertions(+), 71 deletions(-) create mode 100644 .hypothesis/examples/3a76e75eadfd834a/ac569ea775eac75b create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/034b25e396cc3f0d create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/0c7658a22232bd18 create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/10a299eedbad2c49 create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/11f0ea6ee01ff827 create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/280ada4c557ef01f create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/39328dbfe8a7fb12 create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/39582d72ae322f61 create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/3c85f46a982523f2 create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/60aa6060868cc0d6 create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/643053a637c389f4 create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/65c46e75b9714bfa create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/70a3018b9dea89e3 create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/7cc6c2c7e7ef3196 create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/81dfa35ddce51eb5 create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/8975c37d2560face create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/928ffeb4ea6014f9 create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/c42343d5a52b6b7d create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/d1341e1832d26a93 create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/eac03c7087c8e5dc create mode 100644 ciw/.hypothesis/examples/2135bf6f68d836d2/f3d0484011fc8072 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/07f40331c2259991 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/0bfcf1c1a8f79903 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/0f45b4f89ac24914 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/1055f48919b36f33 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/122242e9102ae91b create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/22498c907cff6255 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/2cdf22b064d590ca create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/3b2527623764bb0c create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/3d38aa5af9ec8d22 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/3f120337cce47948 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/43e4dd3cf9d64262 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/4576b9dc91571a03 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/57c835fa3a40c7be create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/5ac90a62cd2d0b69 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/5c57f5f7435178e2 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/63aaa5f14b83350b create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/663509dcd6f64d9e create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/67b93f852bbeb03b create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/6be26f5cb9a2c0ab create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/72c174b8feaa0c36 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/76cfd55801974d94 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/7946df86e6703f4e create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/7b9a60dbb99b9c33 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/83cba6a87fd0c85a create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/8597d3914015f19c create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/9bab9a947e0c871b create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/a65199641d904138 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/a7ef7f837f3956ed create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/aad72d7cff4c7d1a create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/ac569ea775eac75b create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/b4f767c02f877c4d create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/befb43ad3a3d52eb create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/bf76ae898da72578 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/cdeb5699b25c89ae create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/ce408bd66e07df31 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/d0eedfe923594419 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/d16c9ac675f0224a create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/dddff10eff3de080 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/df8302c6c567f205 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/e971ec0c42dafad6 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/f89a5e9b29fb0981 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/fb17b4ef55e73ff1 create mode 100644 ciw/.hypothesis/examples/29d64452f36fbdaf/fc538629f5460a21 create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/0c68cc8d7c2faa3a create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/2aa8bf5054776e2d create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/2b59f590de4f56c6 create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/31fcde061fbf718e create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/3e4ee714c0f29721 create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/4089e312182cc8e7 create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/474b4b9a5cd00cce create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/4e64759a3832e641 create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/5ee4626988dce731 create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/634d8517fbda46d0 create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/7addb7533cee8d9b create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/9b1fa05eb3cfbd5c create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/b55807bf10571b2b create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/c31a9ca6bff3b4ec create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/d3b84c2b8daf4b81 create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/d642a71473e62200 create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/dd081cb25a7a8b67 create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/ddf119247b4aca3f create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/ecd5d83f24df8ea6 create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/f5328cc719115bd6 create mode 100644 ciw/.hypothesis/examples/377a0dd4811fba04/fa52af9de5887c33 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/05e0e870e22f368f create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/138f4155c3c5fd55 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/3b192e19e5b57b22 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/3b2527623764bb0c create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/3d38aa5af9ec8d22 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/41340a27761fc1ee create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/43f1b35e185d76b3 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/44486db86cb11664 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/447101682c49d83c create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/4576b9dc91571a03 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/571a6b9cae7746ab create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/5c57f5f7435178e2 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/62f835dc6d94a701 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/63aaa5f14b83350b create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/63be77937c3437fb create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/6be26f5cb9a2c0ab create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/734fc3cad67bae63 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/76cfd55801974d94 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/7946df86e6703f4e create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/7b9a60dbb99b9c33 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/8038403e33dbdc33 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/914e9a698e01dafd create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/948c69a015222d1b create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/9b06d71d989a59bf create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/a292dce0d8772b0c create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/ac569ea775eac75b create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/baa66fafcc3fe3ca create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/befb43ad3a3d52eb create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/bf76ae898da72578 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/c389f4dead366e47 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/c6610b476a7ec7bc create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/cd5bb8f67cd3ecf2 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/ce408bd66e07df31 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/da214baba10761e0 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/db9b9b85ce11448d create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/dc8c2cadd174e8bb create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/de13e4dcb15227d8 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/e5e827fb49bb3743 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/eb1a640421daa788 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/f73017c6a181c088 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/f89a5e9b29fb0981 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/fc538629f5460a21 create mode 100644 ciw/.hypothesis/examples/3a76e75eadfd834a/fedbd61fbad0a7a8 create mode 100644 ciw/.hypothesis/examples/69ab7130ae480724/1b24950b35f29d6f create mode 100644 ciw/.hypothesis/examples/69ab7130ae480724/30489ccb7a447d7c create mode 100644 ciw/.hypothesis/examples/69ab7130ae480724/6f5a1b20f7726104 create mode 100644 ciw/.hypothesis/examples/69ab7130ae480724/93e8767cb804d887 create mode 100644 ciw/.hypothesis/examples/69ab7130ae480724/9cdc7593276f757f create mode 100644 ciw/.hypothesis/examples/69ab7130ae480724/a105af65d5b4b660 create mode 100644 ciw/.hypothesis/examples/69ab7130ae480724/d1a76c372251fd27 create mode 100644 ciw/.hypothesis/examples/69ab7130ae480724/e7d363ef91203276 create mode 100644 ciw/.hypothesis/examples/69ab7130ae480724/ffe961fa96847bc4 create mode 100644 ciw/.hypothesis/examples/8c8860643dae35d1/6de690448c449507 create mode 100644 ciw/.hypothesis/examples/8c8860643dae35d1/d3399b7262fb56cb create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/17e7f21a2c8ef40f create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/1c43dc8de6f02601 create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/252b611bdb919e2d create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/33aab90d29084756 create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/382ac23a6bc6ea99 create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/3e65b4d379f37bca create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/3fe4b13f2d35df34 create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/413f43e0266269ed create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/4514052d819dc1a3 create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/60c09324887da01b create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/8de08614d440e1ba create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/a0c3b1b68de2d4bd create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/ab5f6935103030fb create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/ac5be3b02f0e8fd6 create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/b1b33a7a1346a013 create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/b599f5378698ac2c create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/c665ae7d6adb0d2a create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/d4f90af82fb4dcb2 create mode 100644 ciw/.hypothesis/examples/8f69b08f1956c2f7/f019fc978a91b344 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/0f910c795309b46f create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/1c0cf4c5a5fb1226 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/1c3c5a498b8754a0 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/2469456be6b9deba create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/2626b3797e2d0970 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/274f542c0a374f79 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/27ea110ec6978fc9 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/28c49ea88b21b4bb create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/3482c8bfece70225 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/3a518690382fbcbc create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/406c004fa66bd45d create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/46fca603494c30a0 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/49225726976757b5 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/4d614399be03eb33 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/56c9d45c6c14bf73 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/5f3e5a80acb61799 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/6510dc8ddd11d095 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/65e3b4ebea18d3cb create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/6dbd341a6c17e89a create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/70513ceef60a7920 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/73c7c8f251a560bb create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/85c89acff90010cb create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/86f8a2adee4579b7 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/880731d44169d3f1 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/884f3914d1cffa77 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/8d79a944b59a71be create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/a69fadadd03f3f79 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/a6e7c35e074fde76 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/ab5a95af6472ebcd create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/abe180733b21a3c1 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/b20e8032b2c91fe1 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/b7009287b23d0685 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/c2865d21e13c5816 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/c3dccc25b1dc0fa3 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/c5327d1b65f122a9 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/c79fcd445f67f1cc create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/cd232c37fc5e059c create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/dadcabc3cd12e89f create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/dfbb200b6fb9e974 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/e303988855ce4704 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/e9713268c587a303 create mode 100644 ciw/.hypothesis/examples/a40d01c034da88b1/f207074e4dc8c0c3 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/0073662f6ce0c7b3 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/0278ab1971aed195 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/0d8bfc746159449b create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/0fd8474e4914135c create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/25d5b9279b919aa9 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/2a5f989d9f086c26 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/2c50eb089aad0c9a create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/33eaae48604249fe create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/379635829c16b65d create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/37f1bb9145de649c create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/42fd038c68db876d create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/4573964e3d9a89b7 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/465fe65d86537e10 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/544a97521b7cf469 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/566872ef33ff7c96 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/5765a394e06bc2d1 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/5e2d3d6ee09a381a create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/67cd259f7ee34827 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/739ba048e2d61501 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/73f1bade3ff1b207 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/7d331bba524859f3 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/863788abf4d4a9f9 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/9aed3ab26f49aecf create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/9b9253615e268fb3 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/9f47c80709ddbdab create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/a03b8168d51f08b8 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/a187b14d402a5dd7 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/a309b7dadbd46083 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/a4bcc319ef6f4958 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/a55ccd0730899da4 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/aae8f6f1a01d193f create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/b1508d25aa9a5aa5 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/b80aa24bf5892ac2 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/c7b007fdd372488e create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/df81bc0733581adf create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/e1bee70c82463f7b create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/e5814487960bcb85 create mode 100644 ciw/.hypothesis/examples/c105d3723925d8e5/ff6d287ef876de5d create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/0c146bbc7b68dc4a create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/223a3b1db81ce7d2 create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/3719655d41b583a0 create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/38fd35f4f2c4dd8e create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/458f7a0e94240493 create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/4d92c7ed2572b2d4 create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/5c626841645613a4 create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/5f4eac4adea057eb create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/73c0e5297fac3b5d create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/7c34c6a23fd87b43 create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/90cd1afcfb4f3c6e create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/a602ca47fdeed33b create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/b124a569a948fbbe create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/bc33fbaa46b1daf6 create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/c2453768f30f6d11 create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/d4a459102fced1bd create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/e717a6a4a1f1e0ad create mode 100644 ciw/.hypothesis/examples/c6ec2939c8e3de8f/ee677f65e88474d6 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/023e7f04f209194f create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/02ac26433f766cb2 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/0abbde7f77ba6bc4 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/0ee62aee8bf00ed1 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/103311af0e5eb240 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/1a69ba3189259619 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/31216203baeacbf6 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/31aea806ecb09f13 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/4df018352a9a87b0 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/6143e3da447f9493 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/6334e2705629a7dd create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/68c58484bcab2e70 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/6d2a861a27deffa5 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/70ee306bd3759b75 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/76633c3dec6c9973 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/781e20e099c7133c create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/78b84a6c280367e5 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/7b428e48efe8090e create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/7fc631ed0409267c create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/862bf8ee7fa76bfd create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/8fcdf0ad0a8920ca create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/9f6e247174433fa2 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/ad9c8d3cc9fe097a create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/b6842be4fcffa95d create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/b6c0f9a044433f07 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/c1f56dd2207339a5 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/c70d2be73050fa02 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/d372c23b434f3511 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/e08f94226d456a59 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/e98d6873301e8acd create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/ebeb40998926966a create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/ec03f7857e8c4acb create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/f84b4e9a724e4610 create mode 100644 ciw/.hypothesis/examples/eceffc5f24ea1d52/f98d074efc56f20e create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/22316dca9fd4df01 create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/33d10e847e3f63c9 create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/366feeaafbca4d07 create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/4a9a5c3e5c6ed79f create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/4acfd1165465e1a2 create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/4cb46ee91acb4921 create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/5b3cd78eceb2fd76 create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/68c2a79f78307c34 create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/804f0714ecd02a62 create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/85464b03d87ac4c4 create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/941ae18058fd462d create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/94b7bef8231ee172 create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/9578cd0b40d1b09e create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/c3ea47a200e66754 create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/d646d4d128ab236a create mode 100644 ciw/.hypothesis/examples/f0a58a77bff18489/d7c95c90e2ebd646 create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/08ebc83e97bd1ed2 create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/17be08cd1ff82c37 create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/1e1066be39d3eb9f create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/23db1f440b4bbece create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/248007df535b4719 create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/31cd3f2a0f974e08 create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/3fd4d7a247d2d077 create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/509e41f7176fff06 create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/59bffa4336791568 create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/60a4ca8c7a2a550e create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/6767f5f2e8d234d9 create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/67d47a0f45f006c4 create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/690dca1ff62134d6 create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/6a57639aaaea62ab create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/782953ff5c10eb87 create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/7e2c97b163bd804e create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/8293554d7ebef188 create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/af69ac820c3d205f create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/afbedf2e052c4cec create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/e46170106a639a5f create mode 100644 ciw/.hypothesis/examples/fabf589bf8d75544/fba965b3ca7332ee create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/081588724373035b create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/22a469db02ae65e8 create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/2712a269a6e28775 create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/2fbbe9f08c1f9169 create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/5aa9500193e6d9de create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/85fc26a24324319d create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/8d97af2e6e694866 create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/9550af14fce513a8 create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/aae7ac2630134705 create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/b5ef9d3c76060589 create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/bc90e16f5be13edf create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/f22fd856918a8920 create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/f4a9253917a99e1d create mode 100644 ciw/.hypothesis/examples/ff07599ee3bc5e8c/ff0449788b65defd create mode 100644 ciw/.hypothesis/unicodedata/5.2.0/charmap.pickle.gz create mode 100644 ciw/deadlock_detector.py diff --git a/.hypothesis/examples/3a76e75eadfd834a/ac569ea775eac75b b/.hypothesis/examples/3a76e75eadfd834a/ac569ea775eac75b new file mode 100644 index 0000000000000000000000000000000000000000..fe2d6d0f2565fb556e0c9cf8c2754a77b6aaa7c0 GIT binary patch literal 41 XcmcEjzyJpJJ7&Ygh>DZ$l(f3 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/2135bf6f68d836d2/034b25e396cc3f0d b/ciw/.hypothesis/examples/2135bf6f68d836d2/034b25e396cc3f0d new file mode 100644 index 0000000000000000000000000000000000000000..74b139515d4c9be2cdcf7063899541be224d6159 GIT binary patch literal 32 YcmcByNb8+PJZv@2!mklx|=^0t&M_0J)Y3_W%F@ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/2135bf6f68d836d2/11f0ea6ee01ff827 b/ciw/.hypothesis/examples/2135bf6f68d836d2/11f0ea6ee01ff827 new file mode 100644 index 0000000000000000000000000000000000000000..9d4255a6bd83b498ef0956c7359e33201c52acf1 GIT binary patch literal 32 ZcmcByNbbFi_8(hUqqKw(w~0C@HWHvj+t literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/2135bf6f68d836d2/39328dbfe8a7fb12 b/ciw/.hypothesis/examples/2135bf6f68d836d2/39328dbfe8a7fb12 new file mode 100644 index 0000000000000000000000000000000000000000..ff429e1d419177ea9afa23f54bd74bcfc0130b47 GIT binary patch literal 32 YcmcByNbQrm^`7=OYUTr;Quy`QF+zFdzYiSsehwaS25L literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/2135bf6f68d836d2/3c85f46a982523f2 b/ciw/.hypothesis/examples/2135bf6f68d836d2/3c85f46a982523f2 new file mode 100644 index 0000000000000000000000000000000000000000..f069ecb9a076bee92156f57b632d55783e34751b GIT binary patch literal 32 YcmcByNc!)<=U`(Gr5hNKfWoW}0Fm|wHvj+t literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/2135bf6f68d836d2/60aa6060868cc0d6 b/ciw/.hypothesis/examples/2135bf6f68d836d2/60aa6060868cc0d6 new file mode 100644 index 0000000000000000000000000000000000000000..286723112408719400589d15346ae3c34144e0ed GIT binary patch literal 32 YcmcByNbN`-UO!r literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/2135bf6f68d836d2/70a3018b9dea89e3 b/ciw/.hypothesis/examples/2135bf6f68d836d2/70a3018b9dea89e3 new file mode 100644 index 0000000000000000000000000000000000000000..43c5d39d743254e56b9022f87b6f41f7896d2da2 GIT binary patch literal 32 YcmcByNb>#9=U`(Gr5hNKfWoW}0Fwd-Q2+n{ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/2135bf6f68d836d2/7cc6c2c7e7ef3196 b/ciw/.hypothesis/examples/2135bf6f68d836d2/7cc6c2c7e7ef3196 new file mode 100644 index 0000000000000000000000000000000000000000..90299df84c69223537817dd00c2ff45416c4439c GIT binary patch literal 32 XcmZ>800KS-8xRGe8yJv)!mJJeVweS2 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/2135bf6f68d836d2/81dfa35ddce51eb5 b/ciw/.hypothesis/examples/2135bf6f68d836d2/81dfa35ddce51eb5 new file mode 100644 index 0000000000000000000000000000000000000000..aedaf939ce15798d8257c6e125b7f65798e4a31b GIT binary patch literal 32 ZcmcByNb^$^1+nCtPTKV`UYtL literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/2135bf6f68d836d2/d1341e1832d26a93 b/ciw/.hypothesis/examples/2135bf6f68d836d2/d1341e1832d26a93 new file mode 100644 index 0000000000000000000000000000000000000000..4782f5157cd0758274d540b6de7fbcbad91e1769 GIT binary patch literal 32 YcmcBy`0wDr=U`(Gr5hNKfWoW}0E~P~_S*)o&Q~?0>Zwp-j literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/0bfcf1c1a8f79903 b/ciw/.hypothesis/examples/29d64452f36fbdaf/0bfcf1c1a8f79903 new file mode 100644 index 0000000000000000000000000000000000000000..ca33829a0499fbacc4663a6dfdccabf80e338a22 GIT binary patch literal 41 jcmcEjzyJpJJ7@j}F=RjlbB*21O*NAmn#y8L?V$<))G7)q literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/0f45b4f89ac24914 b/ciw/.hypothesis/examples/29d64452f36fbdaf/0f45b4f89ac24914 new file mode 100644 index 0000000000000000000000000000000000000000..03bf208bf4e1f6383caa312959b5587cbd2812c5 GIT binary patch literal 41 jcmZ?Zad5DAV03VR(lQJ{z+7WDb5qTvhNiMuQfeC&7_8=vRG4lr~&}G;t5g! literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/122242e9102ae91b b/ciw/.hypothesis/examples/29d64452f36fbdaf/122242e9102ae91b new file mode 100644 index 0000000000000000000000000000000000000000..a54c4d8ae7afd1eaa1786f8e6fea76029cce5f4d GIT binary patch literal 41 lcmcEjzyJpJJ7>=P4`j)Jc+53+GdI;tYG^8pHMNH-0089~3d8^a literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/22498c907cff6255 b/ciw/.hypothesis/examples/29d64452f36fbdaf/22498c907cff6255 new file mode 100644 index 0000000000000000000000000000000000000000..1f3a9373b3af6d5af9722123d8e6299dadcb1d40 GIT binary patch literal 41 jcmcEjzyJpJJ7&Y1WN1&aRI}m2oC@N literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/3d38aa5af9ec8d22 b/ciw/.hypothesis/examples/29d64452f36fbdaf/3d38aa5af9ec8d22 new file mode 100644 index 0000000000000000000000000000000000000000..0147eee34bc0e826508b6ce37f3a10f3b215e3b1 GIT binary patch literal 41 ZcmcEjzyJpJJ7&Y1WNn|aRJ2S2u}b2 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/3f120337cce47948 b/ciw/.hypothesis/examples/29d64452f36fbdaf/3f120337cce47948 new file mode 100644 index 0000000000000000000000000000000000000000..4e8f3b0f2f230f0b26da29df0239c94df55ec5a3 GIT binary patch literal 41 hcmcEjzyJpJyCAd-h+?j>o4KiGQbSW&tf@Uz0RW@n2$TQ- literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/43e4dd3cf9d64262 b/ciw/.hypothesis/examples/29d64452f36fbdaf/43e4dd3cf9d64262 new file mode 100644 index 0000000000000000000000000000000000000000..c5d459c1f43007751a56a14581b5ed75dc7c9b2c GIT binary patch literal 41 icmcEjzyJpJJ7&Y1WW8^U;qHehY3Ld literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/57c835fa3a40c7be b/ciw/.hypothesis/examples/29d64452f36fbdaf/57c835fa3a40c7be new file mode 100644 index 0000000000000000000000000000000000000000..29d8b6ddec75dfd90f834f7ae8f7fbebaaaa431f GIT binary patch literal 41 lcmcEjzyJpJJ7><^4`j)Jc+53+GdI;tYG^8pHMNH-007&Ygh>2n007Ao3K{?a literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/63aaa5f14b83350b b/ciw/.hypothesis/examples/29d64452f36fbdaf/63aaa5f14b83350b new file mode 100644 index 0000000000000000000000000000000000000000..d2ec2f30a954ec90f3ab61c6b1530d59b6e3c10e GIT binary patch literal 41 YcmcEjzyJpJJ7&Yw1+AH0KL=(?f?J) literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/663509dcd6f64d9e b/ciw/.hypothesis/examples/29d64452f36fbdaf/663509dcd6f64d9e new file mode 100644 index 0000000000000000000000000000000000000000..71256ca1ad2b3dc41bd1bb9497194ca141ba0bf1 GIT binary patch literal 41 fcmcEjzyJpJP+A7WW3I8Axv6GSLsMC-DNF(Ys-XzV literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/67b93f852bbeb03b b/ciw/.hypothesis/examples/29d64452f36fbdaf/67b93f852bbeb03b new file mode 100644 index 0000000000000000000000000000000000000000..2006b2c1ac692a47d4be721532625769e988958b GIT binary patch literal 41 kcmcEjzyJpJJ7)sHe+C&4kGaNf=BAoS4NYaSruI+;00lb>_5c6? literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/6be26f5cb9a2c0ab b/ciw/.hypothesis/examples/29d64452f36fbdaf/6be26f5cb9a2c0ab new file mode 100644 index 0000000000000000000000000000000000000000..3624d7fd38276b293b211b7ece4401870b321714 GIT binary patch literal 41 acmcEjzyJpJJ7&YwBNZO%mV literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/72c174b8feaa0c36 b/ciw/.hypothesis/examples/29d64452f36fbdaf/72c174b8feaa0c36 new file mode 100644 index 0000000000000000000000000000000000000000..26c9e87ccddfbb70f83ab622834ec735a3256a76 GIT binary patch literal 41 jcmZ?Zi3qokWNdeU(lQJ{z+7WDb5qTvhNiMuQ&Ygi8De0LexQvj6}9 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/7946df86e6703f4e b/ciw/.hypothesis/examples/29d64452f36fbdaf/7946df86e6703f4e new file mode 100644 index 0000000000000000000000000000000000000000..37ecafb3eca105f72696f9d2c322f56bfce430d0 GIT binary patch literal 41 ZcmcEjzyJpJJ7&Y1WEh{@&U%;2&Ygh=dX007973EBVv literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/83cba6a87fd0c85a b/ciw/.hypothesis/examples/29d64452f36fbdaf/83cba6a87fd0c85a new file mode 100644 index 0000000000000000000000000000000000000000..16166268dbd847694355b7db84dd37cde6f3dfdf GIT binary patch literal 41 jcmcEj;NW2I!02EPrDYg^fVswQ=BAoS4NYaSrZ5Qr0cs42 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/8597d3914015f19c b/ciw/.hypothesis/examples/29d64452f36fbdaf/8597d3914015f19c new file mode 100644 index 0000000000000000000000000000000000000000..4ecbdff2444b31a7069964f04f0a3ce988f8ec81 GIT binary patch literal 41 jcmcEjzyJpJJ7P~_S*$5c0sy)p35@^% literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/a65199641d904138 b/ciw/.hypothesis/examples/29d64452f36fbdaf/a65199641d904138 new file mode 100644 index 0000000000000000000000000000000000000000..e12b298a3378f45f0750fa7dea46926ee88b0b5e GIT binary patch literal 41 mcmcEjzyJpJJ7>P~_S*)o&Q~?0)Zwnm& literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/a7ef7f837f3956ed b/ciw/.hypothesis/examples/29d64452f36fbdaf/a7ef7f837f3956ed new file mode 100644 index 0000000000000000000000000000000000000000..23e5df7336a2796d7b1726873481ef2eb0cc0023 GIT binary patch literal 41 jcmcEjz~Er-!02EPrDYg^fVswQ=BAoS4NYaSrZ5Qr?pq7W literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/aad72d7cff4c7d1a b/ciw/.hypothesis/examples/29d64452f36fbdaf/aad72d7cff4c7d1a new file mode 100644 index 0000000000000000000000000000000000000000..d675e53426745c7e0f833ef1d5e687b6ce2a0280 GIT binary patch literal 41 kcmcEjzyJpJJ7)sHeg+v3kGaNf=BAoS4NYaSruI+;0RC(Xwg3PC literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/ac569ea775eac75b b/ciw/.hypothesis/examples/29d64452f36fbdaf/ac569ea775eac75b new file mode 100644 index 0000000000000000000000000000000000000000..fe2d6d0f2565fb556e0c9cf8c2754a77b6aaa7c0 GIT binary patch literal 41 XcmcEjzyJpJJ7&Ygh>DZ$l(f3 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/b4f767c02f877c4d b/ciw/.hypothesis/examples/29d64452f36fbdaf/b4f767c02f877c4d new file mode 100644 index 0000000000000000000000000000000000000000..58676646a708071236c96427a1c4cc7874e7d77b GIT binary patch literal 41 jcmcEjz`(%Z!02EPrDcFz2Id;OnVV`RH8hpQn!+Ri%Hax4 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/befb43ad3a3d52eb b/ciw/.hypothesis/examples/29d64452f36fbdaf/befb43ad3a3d52eb new file mode 100644 index 0000000000000000000000000000000000000000..24a91d35c77f8a4b666b705ec47fed21e39effc2 GIT binary patch literal 41 acmcEjzyJpJJ7&YwBPw3%mV&YwBH5c006vN2DktK literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/cdeb5699b25c89ae b/ciw/.hypothesis/examples/29d64452f36fbdaf/cdeb5699b25c89ae new file mode 100644 index 0000000000000000000000000000000000000000..bf4449e9a98a72140f6099bf2f14cc20c435fa45 GIT binary patch literal 41 jcmcEjzyJpJJ7?|(F=RjlbB*21O*NAmn#y8L?V$<)%&H0N literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/ce408bd66e07df31 b/ciw/.hypothesis/examples/29d64452f36fbdaf/ce408bd66e07df31 new file mode 100644 index 0000000000000000000000000000000000000000..0de6cf2ad64f3b92b8dc9a9bfad15480abb7d7dd GIT binary patch literal 41 YcmcEjzyJpJJ7&Ygi7oO0Lcala{vGU literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/d0eedfe923594419 b/ciw/.hypothesis/examples/29d64452f36fbdaf/d0eedfe923594419 new file mode 100644 index 0000000000000000000000000000000000000000..aeaa3f79cf8b94774fecf13aad767ba0d0f11cdb GIT binary patch literal 41 pcmZ?Zi3qokWNdeU(lQJ{z+7WDb5qTvhNiMuQwNLoa|ZgBTL9$x42%E( literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/d16c9ac675f0224a b/ciw/.hypothesis/examples/29d64452f36fbdaf/d16c9ac675f0224a new file mode 100644 index 0000000000000000000000000000000000000000..d90e5916667a94ea7311800d810380c780db9d46 GIT binary patch literal 41 vcmZ?Zi3qokWNdeEPM!71#%rex0}wFR*v;HjGpV7eEY{S)qWzqKzU3AG6F3ee literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/dddff10eff3de080 b/ciw/.hypothesis/examples/29d64452f36fbdaf/dddff10eff3de080 new file mode 100644 index 0000000000000000000000000000000000000000..14852c83d2c1dd4482405a50ba05f02683cbdaf0 GIT binary patch literal 41 gcmcEjzyJac_E1^|#AB|po4KiGQbSW&tSL+a0J-4_iU0rr literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/df8302c6c567f205 b/ciw/.hypothesis/examples/29d64452f36fbdaf/df8302c6c567f205 new file mode 100644 index 0000000000000000000000000000000000000000..176b83b589f097406028f115be9f7007e08db86d GIT binary patch literal 41 jcmcEj@8DqX!02EPrDYg^fVswQ=BAoS4NYaSrZ5Qr1`7feC&7_8=vRG4lr~&}Oq6v}! literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/f89a5e9b29fb0981 b/ciw/.hypothesis/examples/29d64452f36fbdaf/f89a5e9b29fb0981 new file mode 100644 index 0000000000000000000000000000000000000000..0f73ab1a8747174c591207971ea6b04719b646ca GIT binary patch literal 41 ZcmcEjzyJpJJ7&Y1WD`%@&U!-2&e!6 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/fb17b4ef55e73ff1 b/ciw/.hypothesis/examples/29d64452f36fbdaf/fb17b4ef55e73ff1 new file mode 100644 index 0000000000000000000000000000000000000000..4dbba0857a1d021c8c91d23718d7290f70d5430e GIT binary patch literal 41 jcmcEj?%-hW!02EPrDYg^fVswQ=BAoS4NYaSrZ5Qr1CtD& literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/29d64452f36fbdaf/fc538629f5460a21 b/ciw/.hypothesis/examples/29d64452f36fbdaf/fc538629f5460a21 new file mode 100644 index 0000000000000000000000000000000000000000..5b75d55dbee2fc6c0006b5ee297a1e7ba06fa4c7 GIT binary patch literal 41 acmcEjzyJpJJ7&Y1WWv9U;qHfM+t!d literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/377a0dd4811fba04/0c68cc8d7c2faa3a b/ciw/.hypothesis/examples/377a0dd4811fba04/0c68cc8d7c2faa3a new file mode 100644 index 0000000000000000000000000000000000000000..fbbe39cac783ecda72e8e72b4c851df2ccf5f502 GIT binary patch literal 40 jcmZQzKmy%o);JvQ01G%QwSAg(_TOoTLs$7Z!o-w*>$WnF6i= literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/05e0e870e22f368f b/ciw/.hypothesis/examples/3a76e75eadfd834a/05e0e870e22f368f new file mode 100644 index 0000000000000000000000000000000000000000..9b53a0bafaf254d679bdb99085f7f7008da682d1 GIT binary patch literal 41 dcmcEjzyJpJJ7?|(F*q8)TqwcJKhGYj005JH1?K<& literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/138f4155c3c5fd55 b/ciw/.hypothesis/examples/3a76e75eadfd834a/138f4155c3c5fd55 new file mode 100644 index 0000000000000000000000000000000000000000..c69ccd342118317bc1b1ea136a2c699fcd14f456 GIT binary patch literal 41 fcmcEjzyJpJJ7>e_3~mo+-&S1GGEl0`O6881_mU+%s&Y1WN1&aRI}m2oC@N literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/3d38aa5af9ec8d22 b/ciw/.hypothesis/examples/3a76e75eadfd834a/3d38aa5af9ec8d22 new file mode 100644 index 0000000000000000000000000000000000000000..0147eee34bc0e826508b6ce37f3a10f3b215e3b1 GIT binary patch literal 41 ZcmcEjzyJpJJ7&Y1WNn|aRJ2S2u}b2 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/41340a27761fc1ee b/ciw/.hypothesis/examples/3a76e75eadfd834a/41340a27761fc1ee new file mode 100644 index 0000000000000000000000000000000000000000..d409284c70f54ac2b09dba48abdb2ddf22500ae8 GIT binary patch literal 41 ecmcEjzyJpJJ7><^4`gvPK==@nnSY)=Q~>~_tOkGp literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/43f1b35e185d76b3 b/ciw/.hypothesis/examples/3a76e75eadfd834a/43f1b35e185d76b3 new file mode 100644 index 0000000000000000000000000000000000000000..4022e524f4eb2bb0a13c5fa8bd46e46c0cef695d GIT binary patch literal 41 dcmcEjzyJpJJ7480p$Y(Mv;>d< literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/447101682c49d83c b/ciw/.hypothesis/examples/3a76e75eadfd834a/447101682c49d83c new file mode 100644 index 0000000000000000000000000000000000000000..b031cde68e06d9704f8df83551738fd8bd814c98 GIT binary patch literal 41 ecmcEjzyJpJJ7)sHe+G^Q2p>W+^Ut$~DgXe>{|E8_ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/4576b9dc91571a03 b/ciw/.hypothesis/examples/3a76e75eadfd834a/4576b9dc91571a03 new file mode 100644 index 0000000000000000000000000000000000000000..32ec196544588d62c5d4756242a2dfa5944001cc GIT binary patch literal 41 acmcEjzyJpJJ7&Y1WW8^U;qHehY3Ld literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/571a6b9cae7746ab b/ciw/.hypothesis/examples/3a76e75eadfd834a/571a6b9cae7746ab new file mode 100644 index 0000000000000000000000000000000000000000..2ea357c953270dc17bf67096c5ae5df20bffd75c GIT binary patch literal 41 dcmcEjzyJpJJ7&Ygh>2n007Ao3K{?a literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/62f835dc6d94a701 b/ciw/.hypothesis/examples/3a76e75eadfd834a/62f835dc6d94a701 new file mode 100644 index 0000000000000000000000000000000000000000..d66dff66d0a24fbe012e98cf8dac5ef233ba05e9 GIT binary patch literal 41 YcmcEjzyJpJP@1Cw!iSK|{PSQE0C98##sB~S literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/63aaa5f14b83350b b/ciw/.hypothesis/examples/3a76e75eadfd834a/63aaa5f14b83350b new file mode 100644 index 0000000000000000000000000000000000000000..d2ec2f30a954ec90f3ab61c6b1530d59b6e3c10e GIT binary patch literal 41 YcmcEjzyJpJJ7&Yw1+AH0KL=(?f?J) literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/63be77937c3437fb b/ciw/.hypothesis/examples/3a76e75eadfd834a/63be77937c3437fb new file mode 100644 index 0000000000000000000000000000000000000000..07866629b57e685a803a45a3ee6c9801861c9392 GIT binary patch literal 41 ecmcEjzyJpJJ7)sHeg=*P2p>W+^Ut$~DgXe*KL@e^ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/6be26f5cb9a2c0ab b/ciw/.hypothesis/examples/3a76e75eadfd834a/6be26f5cb9a2c0ab new file mode 100644 index 0000000000000000000000000000000000000000..3624d7fd38276b293b211b7ece4401870b321714 GIT binary patch literal 41 acmcEjzyJpJJ7&YwBNZO%mV literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/734fc3cad67bae63 b/ciw/.hypothesis/examples/3a76e75eadfd834a/734fc3cad67bae63 new file mode 100644 index 0000000000000000000000000000000000000000..a334aca09aa39bdcc7eb82cf92ef652fc1b8a1b6 GIT binary patch literal 41 bcmZ<|aS(N2c5rZj(i{y8NPwAt9!vrNcxVNE literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/76cfd55801974d94 b/ciw/.hypothesis/examples/3a76e75eadfd834a/76cfd55801974d94 new file mode 100644 index 0000000000000000000000000000000000000000..3f6f191ffb47bfeb40cdbcc45f2c8b92d84d2750 GIT binary patch literal 41 YcmcEjzyJpJJ7&Ygi8De0LexQvj6}9 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/7946df86e6703f4e b/ciw/.hypothesis/examples/3a76e75eadfd834a/7946df86e6703f4e new file mode 100644 index 0000000000000000000000000000000000000000..37ecafb3eca105f72696f9d2c322f56bfce430d0 GIT binary patch literal 41 ZcmcEjzyJpJJ7&Y1WEh{@&U%;2&Ygh=dX007973EBVv literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/8038403e33dbdc33 b/ciw/.hypothesis/examples/3a76e75eadfd834a/8038403e33dbdc33 new file mode 100644 index 0000000000000000000000000000000000000000..d810cb431d9677e095d362ded748af3b463b1f41 GIT binary patch literal 41 ecmcEjzyJpJJ7>=P4`gvPK==@nnSY)=Q~?01>;}L9 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/914e9a698e01dafd b/ciw/.hypothesis/examples/3a76e75eadfd834a/914e9a698e01dafd new file mode 100644 index 0000000000000000000000000000000000000000..2ef77a50a30df086a1224cd53d0cdf88d0485721 GIT binary patch literal 41 ccmcEjz`(%3?BHMzr8ydad^lj{p9hlw0FiwLPXGV_ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/948c69a015222d1b b/ciw/.hypothesis/examples/3a76e75eadfd834a/948c69a015222d1b new file mode 100644 index 0000000000000000000000000000000000000000..6b488bb6f1acd0aed039fb5f70c9327a7daf37e6 GIT binary patch literal 41 bcmZ<|nJ?&Ygh>DZ$l(f3 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/baa66fafcc3fe3ca b/ciw/.hypothesis/examples/3a76e75eadfd834a/baa66fafcc3fe3ca new file mode 100644 index 0000000000000000000000000000000000000000..8bb873b4d736c8031fe8d194e7069aeaaa973994 GIT binary patch literal 41 dcmcEjzyJpJJ7@j}F*q8)TqwcJKhGYj005f(1}6Xj literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/befb43ad3a3d52eb b/ciw/.hypothesis/examples/3a76e75eadfd834a/befb43ad3a3d52eb new file mode 100644 index 0000000000000000000000000000000000000000..24a91d35c77f8a4b666b705ec47fed21e39effc2 GIT binary patch literal 41 acmcEjzyJpJJ7&YwBPw3%mV&YwBH5c006vN2DktK literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/c389f4dead366e47 b/ciw/.hypothesis/examples/3a76e75eadfd834a/c389f4dead366e47 new file mode 100644 index 0000000000000000000000000000000000000000..d19c083b32a8edd0fa6c2e705ea3b20af014fce0 GIT binary patch literal 41 bcmcEjz#!_t?BHMzr8ycHkN`9PJeULksQL#^ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/c6610b476a7ec7bc b/ciw/.hypothesis/examples/3a76e75eadfd834a/c6610b476a7ec7bc new file mode 100644 index 0000000000000000000000000000000000000000..143528c25706c303578fb3bf038c6a40c075821e GIT binary patch literal 41 icmZ<|nJ?&Ygi7oO0Lcala{vGU literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/da214baba10761e0 b/ciw/.hypothesis/examples/3a76e75eadfd834a/da214baba10761e0 new file mode 100644 index 0000000000000000000000000000000000000000..ca6820c53ed56f13db7539d7b7ff28ad7c7eff07 GIT binary patch literal 41 dcmcEjzyJpJJ746U5&(d-1%?0s literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/eb1a640421daa788 b/ciw/.hypothesis/examples/3a76e75eadfd834a/eb1a640421daa788 new file mode 100644 index 0000000000000000000000000000000000000000..26b56ae9f77940515baeaf6df1be3c4b5bde6bae GIT binary patch literal 41 bcmcEjz`)?Z?BHMzr8ycHkN`9PJeULkqWuRC literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/f73017c6a181c088 b/ciw/.hypothesis/examples/3a76e75eadfd834a/f73017c6a181c088 new file mode 100644 index 0000000000000000000000000000000000000000..377aae0d4aa844dff91537c289e8242cdbc6c461 GIT binary patch literal 41 dcmcEjzyJpJJ7&Y1WD`%@&U!-2&e!6 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/fc538629f5460a21 b/ciw/.hypothesis/examples/3a76e75eadfd834a/fc538629f5460a21 new file mode 100644 index 0000000000000000000000000000000000000000..5b75d55dbee2fc6c0006b5ee297a1e7ba06fa4c7 GIT binary patch literal 41 acmcEjzyJpJJ7&Y1WWv9U;qHfM+t!d literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/3a76e75eadfd834a/fedbd61fbad0a7a8 b/ciw/.hypothesis/examples/3a76e75eadfd834a/fedbd61fbad0a7a8 new file mode 100644 index 0000000000000000000000000000000000000000..f1ff9224aa9a90111c1a139af6286f0fa201b4fe GIT binary patch literal 41 ccmcEjzyJpJJNJWWjs^%HLNfEuvxh1G0D-jyP5=M^ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/69ab7130ae480724/1b24950b35f29d6f b/ciw/.hypothesis/examples/69ab7130ae480724/1b24950b35f29d6f new file mode 100644 index 0000000000000000000000000000000000000000..cf8e0e98f57bde2a74975957693f341e7e270873 GIT binary patch literal 32 NcmZQzzzrCI0000g00jU5 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/69ab7130ae480724/30489ccb7a447d7c b/ciw/.hypothesis/examples/69ab7130ae480724/30489ccb7a447d7c new file mode 100644 index 0000000000000000000000000000000000000000..b6e385f17f09ac7f0230295bd2fa382ac859a12a GIT binary patch literal 32 NcmZQzzy%n=0000r00#g7 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/69ab7130ae480724/6f5a1b20f7726104 b/ciw/.hypothesis/examples/69ab7130ae480724/6f5a1b20f7726104 new file mode 100644 index 0000000000000000000000000000000000000000..3cbf2a41b73a67ec8873589f7f3a41d50cb5d9b0 GIT binary patch literal 32 McmZQzzy}x^0RSTa0{{R3 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/69ab7130ae480724/93e8767cb804d887 b/ciw/.hypothesis/examples/69ab7130ae480724/93e8767cb804d887 new file mode 100644 index 0000000000000000000000000000000000000000..11838b56efc1cb345695e1a32e1ab929e442122a GIT binary patch literal 32 NcmZQzzylZ=836z$00aO4 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/69ab7130ae480724/9cdc7593276f757f b/ciw/.hypothesis/examples/69ab7130ae480724/9cdc7593276f757f new file mode 100644 index 0000000000000000000000000000000000000000..d24cfec5004cca47cf9cbfb745e34f84d11bd2db GIT binary patch literal 32 NcmZQzzyTN`0000y00;m8 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/69ab7130ae480724/a105af65d5b4b660 b/ciw/.hypothesis/examples/69ab7130ae480724/a105af65d5b4b660 new file mode 100644 index 0000000000000000000000000000000000000000..7b055fd7bc2e84dd5340a06c7418305819e64bb9 GIT binary patch literal 32 NcmZQzzzG;Z0000l00sa6 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/69ab7130ae480724/d1a76c372251fd27 b/ciw/.hypothesis/examples/69ab7130ae480724/d1a76c372251fd27 new file mode 100644 index 0000000000000000000000000000000000000000..c078b870b16ac4215a8d6fd02771220bf1b23a60 GIT binary patch literal 32 TcmZQzzz!Vxu1iNu literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/8f69b08f1956c2f7/1c43dc8de6f02601 b/ciw/.hypothesis/examples/8f69b08f1956c2f7/1c43dc8de6f02601 new file mode 100644 index 0000000000000000000000000000000000000000..495532c2e6eb5f53fe52461100508fac8b59c8f9 GIT binary patch literal 32 XcmcByNUC>ma1gME(hUsAz@irbd7A~s literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/8f69b08f1956c2f7/252b611bdb919e2d b/ciw/.hypothesis/examples/8f69b08f1956c2f7/252b611bdb919e2d new file mode 100644 index 0000000000000000000000000000000000000000..7efd9ddcf7ffad8569814d0cfbd8fec9819520f9 GIT binary patch literal 32 XcmZ=*mYdV?bGv{8lx|=^1{S>l%r6N< literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/8f69b08f1956c2f7/33aab90d29084756 b/ciw/.hypothesis/examples/8f69b08f1956c2f7/33aab90d29084756 new file mode 100644 index 0000000000000000000000000000000000000000..95983a66ef5d369941faeb2541b9eb9488739306 GIT binary patch literal 32 XcmcByNbZRr5hNKfkiI>lA8v` literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/8f69b08f1956c2f7/3e65b4d379f37bca b/ciw/.hypothesis/examples/8f69b08f1956c2f7/3e65b4d379f37bca new file mode 100644 index 0000000000000000000000000000000000000000..840a7f191857ea0ed53702c1b19a24ff28614437 GIT binary patch literal 32 UcmcDocK`tadnnz&fD9~p0dP+RVgLXD literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/8f69b08f1956c2f7/3fe4b13f2d35df34 b/ciw/.hypothesis/examples/8f69b08f1956c2f7/3fe4b13f2d35df34 new file mode 100644 index 0000000000000000000000000000000000000000..cfb56c63dd42decb8edeeb08ae4d5fdafe6fd832 GIT binary patch literal 32 XcmcByNbl%h?HL literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/8f69b08f1956c2f7/413f43e0266269ed b/ciw/.hypothesis/examples/8f69b08f1956c2f7/413f43e0266269ed new file mode 100644 index 0000000000000000000000000000000000000000..1dffae6eaf73e56060b7a1fc4ffc76a91e717faa GIT binary patch literal 32 WcmcBy`0oG&0`^e4fdLs<^a22lF$RJF literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/8f69b08f1956c2f7/4514052d819dc1a3 b/ciw/.hypothesis/examples/8f69b08f1956c2f7/4514052d819dc1a3 new file mode 100644 index 0000000000000000000000000000000000000000..08ad998baf3f8142e60fc709841d71b50b76381b GIT binary patch literal 32 XcmcByNbZRr5hNKfkiI>ji&~n literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/8f69b08f1956c2f7/60c09324887da01b b/ciw/.hypothesis/examples/8f69b08f1956c2f7/60c09324887da01b new file mode 100644 index 0000000000000000000000000000000000000000..b35d73a7556d7fe53895b6b23cf7efe3d9746973 GIT binary patch literal 32 UcmZ>800RLC#f;2>ZRr5hNKfkiI>lcxsY literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/8f69b08f1956c2f7/ab5f6935103030fb b/ciw/.hypothesis/examples/8f69b08f1956c2f7/ab5f6935103030fb new file mode 100644 index 0000000000000000000000000000000000000000..b89d1dc31ee65e6bb7411919639e19fa5dbec7c9 GIT binary patch literal 32 VcmcEj?*IY<_E5Tk0U22I0sxCo24VmJ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/8f69b08f1956c2f7/ac5be3b02f0e8fd6 b/ciw/.hypothesis/examples/8f69b08f1956c2f7/ac5be3b02f0e8fd6 new file mode 100644 index 0000000000000000000000000000000000000000..98c1b7ac869b3314ccf942344fc2faeebd9d6256 GIT binary patch literal 32 VcmcBysCNJY0edLjz<>-adI57W1%dzo literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/8f69b08f1956c2f7/b1b33a7a1346a013 b/ciw/.hypothesis/examples/8f69b08f1956c2f7/b1b33a7a1346a013 new file mode 100644 index 0000000000000000000000000000000000000000..d3ab7715894c482ba1f6d2a7c567bea7bc5e7143 GIT binary patch literal 32 XcmcByNblz}X1q literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/8f69b08f1956c2f7/c665ae7d6adb0d2a b/ciw/.hypothesis/examples/8f69b08f1956c2f7/c665ae7d6adb0d2a new file mode 100644 index 0000000000000000000000000000000000000000..bfd7db7610420d8f5bc384cfebdbadced8cb956b GIT binary patch literal 32 UcmcByNb< literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/1c0cf4c5a5fb1226 b/ciw/.hypothesis/examples/a40d01c034da88b1/1c0cf4c5a5fb1226 new file mode 100644 index 0000000000000000000000000000000000000000..b7bf80b7f2b23bd092e2d17a7ba29cd3457c34f9 GIT binary patch literal 40 ZcmcEjzyJpJJ7%lLd5qo006?&3EBVv literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/1c3c5a498b8754a0 b/ciw/.hypothesis/examples/a40d01c034da88b1/1c3c5a498b8754a0 new file mode 100644 index 0000000000000000000000000000000000000000..3d0f5a0b59f08cfcc43291ce1627026794927b98 GIT binary patch literal 40 ccmcEjzyJpJJ7>=P4`ek!xKJ|1-ySLt0H-wuy8r+H literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/2469456be6b9deba b/ciw/.hypothesis/examples/a40d01c034da88b1/2469456be6b9deba new file mode 100644 index 0000000000000000000000000000000000000000..a920d07581e21b62fd174d3d33e3e5819abd8fef GIT binary patch literal 40 YcmcEjzyJpJyC8G}go2VO{`OFL0B9`)ivR!s literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/2626b3797e2d0970 b/ciw/.hypothesis/examples/a40d01c034da88b1/2626b3797e2d0970 new file mode 100644 index 0000000000000000000000000000000000000000..b3c454028025d52a200d129d719038cdf0257679 GIT binary patch literal 40 ZcmcEjzyJpJJ7%l0>$@(cmTcS2oC@N literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/274f542c0a374f79 b/ciw/.hypothesis/examples/a40d01c034da88b1/274f542c0a374f79 new file mode 100644 index 0000000000000000000000000000000000000000..3fe79fb9c0f6ef723de462f57faf3ac7395940a5 GIT binary patch literal 40 WcmcEjzyJpJJ7%l!o&f?A_`6b literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/27ea110ec6978fc9 b/ciw/.hypothesis/examples/a40d01c034da88b1/27ea110ec6978fc9 new file mode 100644 index 0000000000000000000000000000000000000000..a88ed99f6427ce6cc260373737bdf2833878cb2b GIT binary patch literal 40 ccmcEjzyJpJJ7><^4`ek!xKJ|1-ySLt0H8GndjJ3c literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/28c49ea88b21b4bb b/ciw/.hypothesis/examples/a40d01c034da88b1/28c49ea88b21b4bb new file mode 100644 index 0000000000000000000000000000000000000000..5449e3638aeefdcc9a61139257993edaf7de4ef1 GIT binary patch literal 40 ZcmZ>e<-GIkbkiXRDBZw-3{w1I;s7iX4cPzy literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/3482c8bfece70225 b/ciw/.hypothesis/examples/a40d01c034da88b1/3482c8bfece70225 new file mode 100644 index 0000000000000000000000000000000000000000..41b12b533cffebf692aae441665517fc72e77812 GIT binary patch literal 40 YcmcEjzyJpJJ7%l+V6s}0k)e4xBvhE literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/3a518690382fbcbc b/ciw/.hypothesis/examples/a40d01c034da88b1/3a518690382fbcbc new file mode 100644 index 0000000000000000000000000000000000000000..3d8ebf47a9dcbea109a5ab951256a0f09032f039 GIT binary patch literal 40 acmcEjzyJpJJ7e<-GIkbkiY+NCq%yfKX5}#or;gRH0eY(i8y3D+o3K literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/46fca603494c30a0 b/ciw/.hypothesis/examples/a40d01c034da88b1/46fca603494c30a0 new file mode 100644 index 0000000000000000000000000000000000000000..ef714680da3cbe3e5776a5b1a640260740668595 GIT binary patch literal 40 XcmcEjzyJac_E5S3%!Lst{xER>eRl%lLdE|B0Ke<#Yf8DBZw-3{w0ZpyB|7Y6d0% literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/56c9d45c6c14bf73 b/ciw/.hypothesis/examples/a40d01c034da88b1/56c9d45c6c14bf73 new file mode 100644 index 0000000000000000000000000000000000000000..09a8e537d528584c4141ca91defec2607b64d8b7 GIT binary patch literal 40 WcmcEjzyJpJP`Uxag_0@$FmV8Gw*%lg2ev=xd6c<21_&2Qruf@K%l0>%G>cmTg82u}b2 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/73c7c8f251a560bb b/ciw/.hypothesis/examples/a40d01c034da88b1/73c7c8f251a560bb new file mode 100644 index 0000000000000000000000000000000000000000..437c9794d5395fe149ba2a807c746ba0c4c82705 GIT binary patch literal 40 dcmcEjzyJpJJ7>uQZ2UGw6 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/85c89acff90010cb b/ciw/.hypothesis/examples/a40d01c034da88b1/85c89acff90010cb new file mode 100644 index 0000000000000000000000000000000000000000..6d2d3abb14d6625f7d57b0f3cae68ea1bc0e69a3 GIT binary patch literal 40 acmcEjzyJpJJ7%l+V9*C<^TY@4hMDs literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/884f3914d1cffa77 b/ciw/.hypothesis/examples/a40d01c034da88b1/884f3914d1cffa77 new file mode 100644 index 0000000000000000000000000000000000000000..730349dcc7050d7d1cdb21ee75b490d85cf4ac4e GIT binary patch literal 40 acmcEjz`(%Z;NV~nr5k`;1W56Ri30$gHwOU# literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/8d79a944b59a71be b/ciw/.hypothesis/examples/a40d01c034da88b1/8d79a944b59a71be new file mode 100644 index 0000000000000000000000000000000000000000..dc807a0323ce41d59f9d66bf964aa34f0c583d02 GIT binary patch literal 40 XcmcEjz`)=D1olw6fdLt$_`}2jt~Uq4 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/a69fadadd03f3f79 b/ciw/.hypothesis/examples/a40d01c034da88b1/a69fadadd03f3f79 new file mode 100644 index 0000000000000000000000000000000000000000..51bc9992adaa61f05791ac40e5f6052c2d547dba GIT binary patch literal 40 acmcEjzyJpJJ7%lg2neUFaQ9-$O%CJ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/a6e7c35e074fde76 b/ciw/.hypothesis/examples/a40d01c034da88b1/a6e7c35e074fde76 new file mode 100644 index 0000000000000000000000000000000000000000..393590d1ba05fb32a38099873536d918439612bb GIT binary patch literal 40 acmcEjzyJpJJ7%lg2n$cFaQ9;hzWrJ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/ab5a95af6472ebcd b/ciw/.hypothesis/examples/a40d01c034da88b1/ab5a95af6472ebcd new file mode 100644 index 0000000000000000000000000000000000000000..9aa54cb9991be48da5824e370c3566c7fc5722a8 GIT binary patch literal 40 WcmcEj&*=aH_E5Tk0U4zD!^8o{6bQ)x literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/abe180733b21a3c1 b/ciw/.hypothesis/examples/a40d01c034da88b1/abe180733b21a3c1 new file mode 100644 index 0000000000000000000000000000000000000000..a971bf77a38522d09193947e972bccc005025892 GIT binary patch literal 40 WcmcEjz~BG^_E5Tk0U4zD!^8o<_XvRi literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/b20e8032b2c91fe1 b/ciw/.hypothesis/examples/a40d01c034da88b1/b20e8032b2c91fe1 new file mode 100644 index 0000000000000000000000000000000000000000..e2fe31c0b85fa6f54467b30f32d7fa5ffdc7b8ac GIT binary patch literal 40 WcmcEj&glRG_E5Tk0U4zD!^8o^tO&6H literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/b7009287b23d0685 b/ciw/.hypothesis/examples/a40d01c034da88b1/b7009287b23d0685 new file mode 100644 index 0000000000000000000000000000000000000000..84971da771cbcf0b0f5ef3a5525bfa8777a5565f GIT binary patch literal 40 bcmcEjzyJpJJ7)sHe})DK7fPo1+e766#uf+d literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/c2865d21e13c5816 b/ciw/.hypothesis/examples/a40d01c034da88b1/c2865d21e13c5816 new file mode 100644 index 0000000000000000000000000000000000000000..361c952100425babcd54e89bc8dcaf28464e0db1 GIT binary patch literal 40 ZcmcEjzyJpJJ7%lLd5?w006^O3K{?a literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/c3dccc25b1dc0fa3 b/ciw/.hypothesis/examples/a40d01c034da88b1/c3dccc25b1dc0fa3 new file mode 100644 index 0000000000000000000000000000000000000000..57bd34fb0085c068bffd4a142f4b12c5c3f199fc GIT binary patch literal 40 ZcmcEjzyJpJJ7%lg2eX&xd6Z;2&e!6 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/c5327d1b65f122a9 b/ciw/.hypothesis/examples/a40d01c034da88b1/c5327d1b65f122a9 new file mode 100644 index 0000000000000000000000000000000000000000..cc7549e4958aa5a541cd355b043e8252ca3002be GIT binary patch literal 40 acmcEjzyJpJJ7%l+VA`i<^TY^jt8~? literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/c79fcd445f67f1cc b/ciw/.hypothesis/examples/a40d01c034da88b1/c79fcd445f67f1cc new file mode 100644 index 0000000000000000000000000000000000000000..e80a405a6fb4957663f8716120d0dbc2372ce8c7 GIT binary patch literal 40 bcmcEjzyJpJJ7?|(F&e-;7?I*{50wW1kDmqN literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/cd232c37fc5e059c b/ciw/.hypothesis/examples/a40d01c034da88b1/cd232c37fc5e059c new file mode 100644 index 0000000000000000000000000000000000000000..1cb17865f0404561ff2d64383f2ea1336a5f6ca8 GIT binary patch literal 40 XcmcEjzyJpJJ7%l+C$|5xD^KO literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/dadcabc3cd12e89f b/ciw/.hypothesis/examples/a40d01c034da88b1/dadcabc3cd12e89f new file mode 100644 index 0000000000000000000000000000000000000000..2f866f1371ceda1e86ba88ec7055a3682cea7c63 GIT binary patch literal 40 fcmZ>e<-GIkbkiXRDBZw-3{w0Zf=d;eB`r+>C#MV4 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/dfbb200b6fb9e974 b/ciw/.hypothesis/examples/a40d01c034da88b1/dfbb200b6fb9e974 new file mode 100644 index 0000000000000000000000000000000000000000..71acd83974fea21e62b14c900d1a5f3403028848 GIT binary patch literal 40 ZcmcEjzyJpJJO6{}1_&2Qruf@Kz>% literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/e9713268c587a303 b/ciw/.hypothesis/examples/a40d01c034da88b1/e9713268c587a303 new file mode 100644 index 0000000000000000000000000000000000000000..56198077e506e26e97f34672e20a019f0fa1ccdc GIT binary patch literal 40 YcmcEjzyJpJJ7%lLdEw30K-QLa{vGU literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/a40d01c034da88b1/f207074e4dc8c0c3 b/ciw/.hypothesis/examples/a40d01c034da88b1/f207074e4dc8c0c3 new file mode 100644 index 0000000000000000000000000000000000000000..b8998443b2b5c0c2fc8bc583c7a37fe56dbfc4b5 GIT binary patch literal 40 dcmcEjzyJpJJ7>u672NVDR literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/0073662f6ce0c7b3 b/ciw/.hypothesis/examples/c105d3723925d8e5/0073662f6ce0c7b3 new file mode 100644 index 0000000000000000000000000000000000000000..144161c5181568e16ab327063eb413c780cac2c1 GIT binary patch literal 42 icmcDYQuWY%ok%sKeL#}$rH?EBFn}4~MFJZbPyqm7{0v3_ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/0278ab1971aed195 b/ciw/.hypothesis/examples/c105d3723925d8e5/0278ab1971aed195 new file mode 100644 index 0000000000000000000000000000000000000000..f3b1083256a1e8454f01862a27c8918dce9e3c99 GIT binary patch literal 42 ZcmcDYQuWY%ok%sKJ(R%!V>B?J0sv5}3zz@^ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/0d8bfc746159449b b/ciw/.hypothesis/examples/c105d3723925d8e5/0d8bfc746159449b new file mode 100644 index 0000000000000000000000000000000000000000..650c65eebeacae2bfb9a04744b8402e45eae6314 GIT binary patch literal 123 zcmcDYQuWY%ok%sK!=A@?p0EBohtXl%??r4Hf20^4md^}tIBE2R(P3)x6~)3rEk=jJ zJ)!-v(eoG`iVsXs<4ZPXbO_B7G)!RM#OQFig8>8>9ai7^lA-hNCZoflowHg`-)LoU R=y50w-7vGe0jvN)005nOEqVX| literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/0fd8474e4914135c b/ciw/.hypothesis/examples/c105d3723925d8e5/0fd8474e4914135c new file mode 100644 index 0000000000000000000000000000000000000000..5aa096e99890225c3a3102f418aac27ad6cf0f52 GIT binary patch literal 42 gcmcDYQuWY%ok%sKeL#}$rH?EBGuT5#8W>Ok0B9Wyj{pDw literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/25d5b9279b919aa9 b/ciw/.hypothesis/examples/c105d3723925d8e5/25d5b9279b919aa9 new file mode 100644 index 0000000000000000000000000000000000000000..f043bfa6dc575db9dea60f1a9b479c02d34c089c GIT binary patch literal 42 kcmcDYQuWY%ok%sKeL#}$rH?EBFaQ~W?tvnK4GgFN07@bY82|tP literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/2a5f989d9f086c26 b/ciw/.hypothesis/examples/c105d3723925d8e5/2a5f989d9f086c26 new file mode 100644 index 0000000000000000000000000000000000000000..c3091adbd5dd92c6cd7074dae2cd585330ee3d62 GIT binary patch literal 42 kcmcDYQuWY%ok%sKeL#}$rH?EBFaQ|=?tvnK4GgFN07?xD7ytkO literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/2c50eb089aad0c9a b/ciw/.hypothesis/examples/c105d3723925d8e5/2c50eb089aad0c9a new file mode 100644 index 0000000000000000000000000000000000000000..03e61fec049b4d2f281fd36ef9664135d1644c42 GIT binary patch literal 105 zcmcDYQuWY%ok%sK!}6Ko4JVDBFgi?4zM@!IsKw||xF@tfHhLbTL-BzLYJADYj1Hk$ xf`$p~n;0DqcQAkeqr>W3Uov#w-DGq)v~yPL=^L#K4m}Q~p&Mp)H-Hr&2mnjlBf|gy literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/33eaae48604249fe b/ciw/.hypothesis/examples/c105d3723925d8e5/33eaae48604249fe new file mode 100644 index 0000000000000000000000000000000000000000..9399b2165da0a44ba6c4ab8e2b7daa6e10d45920 GIT binary patch literal 42 gcmcDYQuWY%ok%sKeL#}$rH?EBFhCi98yHXl0CsQOk0B7k8jQ{`u literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/544a97521b7cf469 b/ciw/.hypothesis/examples/c105d3723925d8e5/544a97521b7cf469 new file mode 100644 index 0000000000000000000000000000000000000000..ac5868ed787682f36898b0ae922d8f60a75d0d6a GIT binary patch literal 51 vcmcDYQuWY%ok%sK!|GdKGIZYEWOO*Rb5`r=8?6iuJr1Rz8)kMlFrWeeR)7)p literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/566872ef33ff7c96 b/ciw/.hypothesis/examples/c105d3723925d8e5/566872ef33ff7c96 new file mode 100644 index 0000000000000000000000000000000000000000..c2dace912143fcf47d13cad4a7421f29075b530c GIT binary patch literal 42 lcmcDYQuWY%ok%sKeL#}$rH?EBFxUsw2f7D}1U4|B0su^)3pM}% literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/5765a394e06bc2d1 b/ciw/.hypothesis/examples/c105d3723925d8e5/5765a394e06bc2d1 new file mode 100644 index 0000000000000000000000000000000000000000..f703689ca40a5f4c9c0c99452834372697b8b5b4 GIT binary patch literal 42 gcmcDYQuWY%ok%sKeL#Jnd!R@lgFRHFfdLf&04a6~LI3~& literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/5e2d3d6ee09a381a b/ciw/.hypothesis/examples/c105d3723925d8e5/5e2d3d6ee09a381a new file mode 100644 index 0000000000000000000000000000000000000000..6390e28289a95395e8e5eb301ed25d9cf7609f07 GIT binary patch literal 42 lcmcDYQuWY%ok%sKeL#}$rH?EBFxUqM2D%4|1U4|B0su(E3kd)K literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/67cd259f7ee34827 b/ciw/.hypothesis/examples/c105d3723925d8e5/67cd259f7ee34827 new file mode 100644 index 0000000000000000000000000000000000000000..7b5d9d7386dc460cd66599e31bb510792725b727 GIT binary patch literal 42 jcmcDYQuWY%ok%sKeL#}$rH?EBFn}2U14RNG7*GKKSS}0A literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/739ba048e2d61501 b/ciw/.hypothesis/examples/c105d3723925d8e5/739ba048e2d61501 new file mode 100644 index 0000000000000000000000000000000000000000..2985ee66e4d10b64c704bb0279e080ef6025def0 GIT binary patch literal 42 gcmcDYQuWY%ok%sKeL#}$rH}su8SJ4V4GgFN0AGU)Hvj+t literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/73f1bade3ff1b207 b/ciw/.hypothesis/examples/c105d3723925d8e5/73f1bade3ff1b207 new file mode 100644 index 0000000000000000000000000000000000000000..27b2a0a4c18c7b2b8d82f056f4bf485b41cee58a GIT binary patch literal 42 gcmcDYQuWY%ok%sKeL#}$rT-#<4E9iw1_o3B07ya$S^xk5 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/7d331bba524859f3 b/ciw/.hypothesis/examples/c105d3723925d8e5/7d331bba524859f3 new file mode 100644 index 0000000000000000000000000000000000000000..6da73003b309d3ab5af3c9ccd50796972278ed9a GIT binary patch literal 42 gcmcDYQuWY%ok%sKeL#}$rH}gq8SJ4V4GgFN09eBd_W%F@ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/863788abf4d4a9f9 b/ciw/.hypothesis/examples/c105d3723925d8e5/863788abf4d4a9f9 new file mode 100644 index 0000000000000000000000000000000000000000..e6e74870b6e461d5854adff4f7becea3e82091ec GIT binary patch literal 42 hcmcDYQuWY%ok%sKeL#}$rH?EBFhCgp0~;7n0RV9j4J!Zu literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/9aed3ab26f49aecf b/ciw/.hypothesis/examples/c105d3723925d8e5/9aed3ab26f49aecf new file mode 100644 index 0000000000000000000000000000000000000000..7661e040592c4d06c46582eb07467d5e43df9687 GIT binary patch literal 42 gcmcDYQuWY%ok%sKeL#}$rH?EBFhCjq8yHXl0CtiMg8%>k literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/9b9253615e268fb3 b/ciw/.hypothesis/examples/c105d3723925d8e5/9b9253615e268fb3 new file mode 100644 index 0000000000000000000000000000000000000000..a1a28caeefdc9b612fdc823846a5abfd557dabe2 GIT binary patch literal 42 gcmcDYQuWY%ok%sKeLzxxd!R@lgFRHFfdLf&043E5Bme*a literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/9f47c80709ddbdab b/ciw/.hypothesis/examples/c105d3723925d8e5/9f47c80709ddbdab new file mode 100644 index 0000000000000000000000000000000000000000..e98e78074280f5b40332bd74f5f68fc23b788b50 GIT binary patch literal 42 gcmcDYQuWY%ok%sKJ(R)V(Bn`Vx?yH_0|P1m08QHqkN^Mx literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/a03b8168d51f08b8 b/ciw/.hypothesis/examples/c105d3723925d8e5/a03b8168d51f08b8 new file mode 100644 index 0000000000000000000000000000000000000000..e8a1fb0b6ab8e5c2d70ee62304300d1d89895f4b GIT binary patch literal 42 gcmcDYQuWY%ok%sKeL#}$rSBqv4E9iw1_o3B07qgAQUCw| literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/a187b14d402a5dd7 b/ciw/.hypothesis/examples/c105d3723925d8e5/a187b14d402a5dd7 new file mode 100644 index 0000000000000000000000000000000000000000..8de1882480fd513adb6692a981d2fac8bd6bca2a GIT binary patch literal 42 gcmcDYQuWY%ok%sKeL#}${XmgG279PT0|P1m05-D@ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/b80aa24bf5892ac2 b/ciw/.hypothesis/examples/c105d3723925d8e5/b80aa24bf5892ac2 new file mode 100644 index 0000000000000000000000000000000000000000..5acc661c64d2a962998bcbbaf7b0a1bd38f8d083 GIT binary patch literal 42 fcmcDYQuWY%ok%sKeL#}$rH?EBFu)iM45$DAc3%yE literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/c7b007fdd372488e b/ciw/.hypothesis/examples/c105d3723925d8e5/c7b007fdd372488e new file mode 100644 index 0000000000000000000000000000000000000000..c704c814747c977554eb9beef524d823130255ba GIT binary patch literal 42 lcmcDYQuWY%ok%sKeL#}$rH?EBFxUtD4|ER{32b0M1prr|3$_3N literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/df81bc0733581adf b/ciw/.hypothesis/examples/c105d3723925d8e5/df81bc0733581adf new file mode 100644 index 0000000000000000000000000000000000000000..8d4d8c690d40430bcf17f686a9fcd73b6749588a GIT binary patch literal 42 gcmcDYQuWY%ok%sKeL#}$rH?EBFxW#y8W>Ok0B6q(i~s-t literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/e1bee70c82463f7b b/ciw/.hypothesis/examples/c105d3723925d8e5/e1bee70c82463f7b new file mode 100644 index 0000000000000000000000000000000000000000..f77946e8a18edb464d7604023d4f20e84fc30573 GIT binary patch literal 42 jcmcDYQuWY%ok%sKeL#}$rH?EBFn}2M14RNG7*GKKRjv!I literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c105d3723925d8e5/e5814487960bcb85 b/ciw/.hypothesis/examples/c105d3723925d8e5/e5814487960bcb85 new file mode 100644 index 0000000000000000000000000000000000000000..2d75590b392ea84192b0618a4bc1d471a6cfb11a GIT binary patch literal 69 zcmcDYQuWY%ok%sKLui(uVFLRmMu)>43?RVhu=>`Q44rp3866JooYi{zMk|9uk3(tb MhMC(^b literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c6ec2939c8e3de8f/0c146bbc7b68dc4a b/ciw/.hypothesis/examples/c6ec2939c8e3de8f/0c146bbc7b68dc4a new file mode 100644 index 0000000000000000000000000000000000000000..3f6a1d42cfa78ecfb4bb4fd811e10767514275e2 GIT binary patch literal 24 TcmcBysCNK?1_mT>WT6-UJAMR8 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c6ec2939c8e3de8f/223a3b1db81ce7d2 b/ciw/.hypothesis/examples/c6ec2939c8e3de8f/223a3b1db81ce7d2 new file mode 100644 index 0000000000000000000000000000000000000000..1b0c0f244779a8b40ed46d3b5327149331683ad4 GIT binary patch literal 24 WcmcByNb8fPe-DByeP*7yvZ91N;C0 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c6ec2939c8e3de8f/38fd35f4f2c4dd8e b/ciw/.hypothesis/examples/c6ec2939c8e3de8f/38fd35f4f2c4dd8e new file mode 100644 index 0000000000000000000000000000000000000000..87dda59be890de1594b81fec692c3f334e335f5c GIT binary patch literal 24 UcmcByNUC=Lf(8a8aActv06r@OYybcN literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c6ec2939c8e3de8f/458f7a0e94240493 b/ciw/.hypothesis/examples/c6ec2939c8e3de8f/458f7a0e94240493 new file mode 100644 index 0000000000000000000000000000000000000000..e673dcf82b64cf14faf8d759b7c893e2c984f147 GIT binary patch literal 24 WcmcByNb;M1& literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c6ec2939c8e3de8f/5c626841645613a4 b/ciw/.hypothesis/examples/c6ec2939c8e3de8f/5c626841645613a4 new file mode 100644 index 0000000000000000000000000000000000000000..e191b3f8d1aa692f8c63335b9e63503121488315 GIT binary patch literal 24 ScmcDocL0M11|)D~p%?%#f;NZ}}fCP>#6axTA{RH^{ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c6ec2939c8e3de8f/7c34c6a23fd87b43 b/ciw/.hypothesis/examples/c6ec2939c8e3de8f/7c34c6a23fd87b43 new file mode 100644 index 0000000000000000000000000000000000000000..432de508485f675c6fdbbe5ba1e1ae9be674ab52 GIT binary patch literal 24 WcmcByNb#6axT8eFWJ6 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c6ec2939c8e3de8f/a602ca47fdeed33b b/ciw/.hypothesis/examples/c6ec2939c8e3de8f/a602ca47fdeed33b new file mode 100644 index 0000000000000000000000000000000000000000..6cf0c6b6f6f7c365581734c4f12bdd2b8471cf88 GIT binary patch literal 24 WcmcByNbj literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c6ec2939c8e3de8f/bc33fbaa46b1daf6 b/ciw/.hypothesis/examples/c6ec2939c8e3de8f/bc33fbaa46b1daf6 new file mode 100644 index 0000000000000000000000000000000000000000..91f39d907d52bb2a652e5950f56cf8dff99dfc40 GIT binary patch literal 24 WcmcByNb=pt literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/c6ec2939c8e3de8f/d4a459102fced1bd b/ciw/.hypothesis/examples/c6ec2939c8e3de8f/d4a459102fced1bd new file mode 100644 index 0000000000000000000000000000000000000000..3de1e501970ac673a64ac7cee36f8bfa90d2be13 GIT binary patch literal 24 WcmcByNb8fP%e08KX5^&N4JGFt~dLELvHVu|vn%Xx>c#wW15* literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/eceffc5f24ea1d52/0abbde7f77ba6bc4 b/ciw/.hypothesis/examples/eceffc5f24ea1d52/0abbde7f77ba6bc4 new file mode 100644 index 0000000000000000000000000000000000000000..ee1a628d907dbc1ae12bd46a86b2f7a938459ea3 GIT binary patch literal 33 pcmcByNb38S(LFu$JuD!O#uId4vGK( literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/eceffc5f24ea1d52/103311af0e5eb240 b/ciw/.hypothesis/examples/eceffc5f24ea1d52/103311af0e5eb240 new file mode 100644 index 0000000000000000000000000000000000000000..3a279a97820031c543adcf2ce6691903406e5d7f GIT binary patch literal 33 lcmcBysCNK^y+0YFHC)azG%zr@dj>38S(LFu$JuD!O#r_l3@-ox literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/eceffc5f24ea1d52/1a69ba3189259619 b/ciw/.hypothesis/examples/eceffc5f24ea1d52/1a69ba3189259619 new file mode 100644 index 0000000000000000000000000000000000000000..dbf65d5da8664dc6d3f84a75fa3b8e85976fabdb GIT binary patch literal 33 kcmcEj?*IXNe=#f00et~GDd5-oMmWWU~u;gShTVzV~38j(Y%`g(#Q38S(LFu$JuD!O#uH;4u}8% literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/eceffc5f24ea1d52/6d2a861a27deffa5 b/ciw/.hypothesis/examples/eceffc5f24ea1d52/6d2a861a27deffa5 new file mode 100644 index 0000000000000000000000000000000000000000..b4d4067307b7a3878294311999f2daed770feb7d GIT binary patch literal 33 lcmcBy`0oG)dw()UYq*?cXkcJ)_Y7FHvM6JRj{k|45a`7 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/eceffc5f24ea1d52/781e20e099c7133c b/ciw/.hypothesis/examples/eceffc5f24ea1d52/781e20e099c7133c new file mode 100644 index 0000000000000000000000000000000000000000..d52601d12e27f3ccb4f2663161982eb681f62f28 GIT binary patch literal 33 ocmcByNbqX-fq}u@GhormqKq9n&PMZY0ssq7<9RL92D+x{j literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/eceffc5f24ea1d52/8fcdf0ad0a8920ca b/ciw/.hypothesis/examples/eceffc5f24ea1d52/8fcdf0ad0a8920ca new file mode 100644 index 0000000000000000000000000000000000000000..059ccca4d6794723a06f348ba78aeb3970704248 GIT binary patch literal 33 ncmcByNbq9#fq}u@GhormqKq9n&PMZY0ss<052FA8 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/eceffc5f24ea1d52/ad9c8d3cc9fe097a b/ciw/.hypothesis/examples/eceffc5f24ea1d52/ad9c8d3cc9fe097a new file mode 100644 index 0000000000000000000000000000000000000000..fb9028ffb9605b86015e90dd6465e026ff52536c GIT binary patch literal 33 pcmcByNb{$d4C4R* literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/eceffc5f24ea1d52/b6842be4fcffa95d b/ciw/.hypothesis/examples/eceffc5f24ea1d52/b6842be4fcffa95d new file mode 100644 index 0000000000000000000000000000000000000000..cae63b7f2a74f5961c51f9d256816645b99210e1 GIT binary patch literal 33 pcmcByNb38S(LFu$JuD!O#uHk4u=2$ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/eceffc5f24ea1d52/b6c0f9a044433f07 b/ciw/.hypothesis/examples/eceffc5f24ea1d52/b6c0f9a044433f07 new file mode 100644 index 0000000000000000000000000000000000000000..845394687d4533b9dc4ce9e3fcf389923507f2bc GIT binary patch literal 33 pcmcByNb{)K4D$d0 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/eceffc5f24ea1d52/c1f56dd2207339a5 b/ciw/.hypothesis/examples/eceffc5f24ea1d52/c1f56dd2207339a5 new file mode 100644 index 0000000000000000000000000000000000000000..d23219e59bca9ff3c237c5530f106ff22c00ee90 GIT binary patch literal 51 zcmV-30L=eDxcN%xYS7m}z4-xKC`8QxK&97Q1aj$h0YJK!b0BisJ^+9K07pqsqN#Fd JxGY05p4oP37O?;T literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/eceffc5f24ea1d52/c70d2be73050fa02 b/ciw/.hypothesis/examples/eceffc5f24ea1d52/c70d2be73050fa02 new file mode 100644 index 0000000000000000000000000000000000000000..440bfd71e5b970645e7d273367bd5ea9e072c9bd GIT binary patch literal 33 pcmcByNbOV literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/eceffc5f24ea1d52/ec03f7857e8c4acb b/ciw/.hypothesis/examples/eceffc5f24ea1d52/ec03f7857e8c4acb new file mode 100644 index 0000000000000000000000000000000000000000..819a9663d85de24663dd63d1241c26c7998bd194 GIT binary patch literal 33 ncmcByNb|804O9RC literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/f0a58a77bff18489/22316dca9fd4df01 b/ciw/.hypothesis/examples/f0a58a77bff18489/22316dca9fd4df01 new file mode 100644 index 0000000000000000000000000000000000000000..6aafd5b684b4008620a2f14f0e5d9b8803c9edb0 GIT binary patch literal 32 WcmZo*Kmwa07{h1)Yr+Yt literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/fabf589bf8d75544/08ebc83e97bd1ed2 b/ciw/.hypothesis/examples/fabf589bf8d75544/08ebc83e97bd1ed2 new file mode 100644 index 0000000000000000000000000000000000000000..48c5b7a127a1774092049b09d459dd6cd4981ad1 GIT binary patch literal 34 YcmZRyuh)0r)?jpCfHN47fVPbv09CdF`2YX_ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/fabf589bf8d75544/17be08cd1ff82c37 b/ciw/.hypothesis/examples/fabf589bf8d75544/17be08cd1ff82c37 new file mode 100644 index 0000000000000000000000000000000000000000..9466bc253d59d741443f740766f5bb5dc7ff330e GIT binary patch literal 43 pcmZQ{IHYzzxJ12x(P5STGj0vW{|pYBXRXwFHcyfP8ED)10RS~U3rqk2 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/fabf589bf8d75544/1e1066be39d3eb9f b/ciw/.hypothesis/examples/fabf589bf8d75544/1e1066be39d3eb9f new file mode 100644 index 0000000000000000000000000000000000000000..3125df9e587fe368c662cd9b5d7fca4491ca66f5 GIT binary patch literal 34 ZcmZRy4@mO8^l{~X1~`KO3258+0RZ7%3JCxJ literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/fabf589bf8d75544/23db1f440b4bbece b/ciw/.hypothesis/examples/fabf589bf8d75544/23db1f440b4bbece new file mode 100644 index 0000000000000000000000000000000000000000..4ce3d8fceca1b16d6fd21fdc5723f4789d32f3a0 GIT binary patch literal 34 YcmZRy4@j!#)?jpCfHN47fVPbv0AjfWe*gdg literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/fabf589bf8d75544/248007df535b4719 b/ciw/.hypothesis/examples/fabf589bf8d75544/248007df535b4719 new file mode 100644 index 0000000000000000000000000000000000000000..255846d822b9a1cea97a09c704631d7dba6de2cc GIT binary patch literal 34 YcmZRy4@mO;ufgcR0B0~D0c{&U0Ec%50{{R3 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/fabf589bf8d75544/31cd3f2a0f974e08 b/ciw/.hypothesis/examples/fabf589bf8d75544/31cd3f2a0f974e08 new file mode 100644 index 0000000000000000000000000000000000000000..bfb4eb7e0b5bf44ca7b483ecb8536f6cc168f8ac GIT binary patch literal 34 ZcmZRy4@mO8^l{}M1~`KO3258+0RZ6L3IhND literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/fabf589bf8d75544/3fd4d7a247d2d077 b/ciw/.hypothesis/examples/fabf589bf8d75544/3fd4d7a247d2d077 new file mode 100644 index 0000000000000000000000000000000000000000..b1d9cc979e51a68eba13181edc6ac9dd1c734a52 GIT binary patch literal 34 YcmZRy52$zG)?jpCfHN47fVPbv09-8uI{*Lx literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/fabf589bf8d75544/509e41f7176fff06 b/ciw/.hypothesis/examples/fabf589bf8d75544/509e41f7176fff06 new file mode 100644 index 0000000000000000000000000000000000000000..9000d3a67f769fb446b014d3e62a63b9876a1f34 GIT binary patch literal 34 YcmZRy4@mO8ufgcR0B0~D0c{&U0D)Hp!vFvP literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/fabf589bf8d75544/59bffa4336791568 b/ciw/.hypothesis/examples/fabf589bf8d75544/59bffa4336791568 new file mode 100644 index 0000000000000000000000000000000000000000..281925f0e8696bcb511cb4e2236d3c8e2dc60625 GIT binary patch literal 34 WcmZRy4@mO8^l{}M1~`KO6#xL=mI+P( literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/fabf589bf8d75544/60a4ca8c7a2a550e b/ciw/.hypothesis/examples/fabf589bf8d75544/60a4ca8c7a2a550e new file mode 100644 index 0000000000000000000000000000000000000000..6fae9194906d50e63ab6177c94d541c794413a42 GIT binary patch literal 34 fcmZQ{Sf&4rTZ8dGgTv-oE47}@lVm^!+BSXwv7HCz literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/fabf589bf8d75544/6767f5f2e8d234d9 b/ciw/.hypothesis/examples/fabf589bf8d75544/6767f5f2e8d234d9 new file mode 100644 index 0000000000000000000000000000000000000000..fd7f049d2d6413f39b9fd6e60a206d62801b4886 GIT binary patch literal 34 YcmZRy4@mO8^qtXx0nT7R0@^ly0HoUoM*si- literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/fabf589bf8d75544/67d47a0f45f006c4 b/ciw/.hypothesis/examples/fabf589bf8d75544/67d47a0f45f006c4 new file mode 100644 index 0000000000000000000000000000000000000000..7c66207590166fd0983f8fd64c62d2595c6f10d5 GIT binary patch literal 34 YcmZRy5BTrEt-#;9&R;03weAQUCw| literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/ff07599ee3bc5e8c/2fbbe9f08c1f9169 b/ciw/.hypothesis/examples/ff07599ee3bc5e8c/2fbbe9f08c1f9169 new file mode 100644 index 0000000000000000000000000000000000000000..33b463b5db75c2eeb3ed7777b5fb1c60f1a3bb63 GIT binary patch literal 35 ecmZo*0D^`F0}zD(%zGIbxET#EF*0y4dn+a literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/ff07599ee3bc5e8c/85fc26a24324319d b/ciw/.hypothesis/examples/ff07599ee3bc5e8c/85fc26a24324319d new file mode 100644 index 0000000000000000000000000000000000000000..648f524c40617fc0ce5ed8074ebe72e78ae7e24c GIT binary patch literal 35 fcmZo*P-+NiXfR+v0nB?D8Mqk@FEKK3Fnk99W5ES? literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/ff07599ee3bc5e8c/8d97af2e6e694866 b/ciw/.hypothesis/examples/ff07599ee3bc5e8c/8d97af2e6e694866 new file mode 100644 index 0000000000000000000000000000000000000000..e605df2c8dc51fc81b1daa73a4f40195c0c8cb90 GIT binary patch literal 35 fcmX>gq4Y1Lt<8V|1u*YrWZ-5ryu`@B!SEdbfYSz9 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/ff07599ee3bc5e8c/9550af14fce513a8 b/ciw/.hypothesis/examples/ff07599ee3bc5e8c/9550af14fce513a8 new file mode 100644 index 0000000000000000000000000000000000000000..3e1add9cbbf02ed40e1afa9639da4b9acf059e51 GIT binary patch literal 35 ccmZo*00RLC1tXdFGBR*88eU>#;9&R;03gq4Y1Lt#;9&R;04K8pfdBvi literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/ff07599ee3bc5e8c/f4a9253917a99e1d b/ciw/.hypothesis/examples/ff07599ee3bc5e8c/f4a9253917a99e1d new file mode 100644 index 0000000000000000000000000000000000000000..670f87c3ebc211aa02d8d7b1e74eac2a89e86703 GIT binary patch literal 35 dcmZo*0D%SrFa;-=_cAhYGa6oEWZ+=<4gfYY1OWg5 literal 0 HcmV?d00001 diff --git a/ciw/.hypothesis/examples/ff07599ee3bc5e8c/ff0449788b65defd b/ciw/.hypothesis/examples/ff07599ee3bc5e8c/ff0449788b65defd new file mode 100644 index 0000000000000000000000000000000000000000..ae418763935052685f14fda8816bb6df175973cc GIT binary patch literal 35 ScmZo*00Tw{g-LQSdQ{G_nW?(MHw~(~5vd7HCBp6~P4} zA_iL&Wif0?L?BU-HDXkj01+ZfL|F_3$zrxS$8YY;+?lz*`R?4`o%yG%^VCyM)j98* zzD+wV^=&jIXeN&yE{6+#;-Zd+%EM>y3R2 zuX!x!tvrUGS&?iq8FK1suVL@i25G_z#~bsKMZM1*5+-{UD<=GY+meW;O$a8QG@MS) zJItCTIcK92{bOh^Q!1SwI1bW&I%E9#&4x5z>Fck39{1MST=2MeUGwSruI}Ei&d)^q z40LgBIexwy(teYiT49wIQ)<4z!xATT>eV&!unfyvS&H>A2n>GEwDX!7zphELH)iVX z%KWQcfwhS1yBbs>jBsI5#mg%%KNkIb!OOX-V)%$N>*b-3TK-jeD-z~!>3Ty;DSCU% z#NW+lRfJQ3n@?2DFF8GadCPCdQugy#L^B%fENvDs<7_Q$u2jt0O)a&mGO@*3Uav;j z;ugODlk6L08cnZgx83m|2X{6n(``?XCus5y$8v+~FQZB=7I+-L5^r2ne$BBiv9QCv zxxXsae@}mTTy`en=5qhaw)16Iu2g$;GY-Z3wDNDp>@%=n#L=hzKGXlMJHchkV1%E$ z&*!SGrIt1aDhx}f)}8n_BnU^bEDgeMw@T}tybBUa`NVFCR@FtJ~59$%O02-+h&#KI?1as zY6bt=zjpKK<-~09zkGncVvFOdyof2&eFn+=3yZAMh_Q5NaX!sGze%bOZe^HOv2l5o z<=MKi`B$bctd6RSh&3Kvn}0jC=&ybJI;-WMV-FV za0`f*HRM*NwVsmfX&&5tl_}jKS#kPrdrogktk19SUT(HZyHRFs=rMF6*b>;~Sne*L zU%UM|yL@g%->70ZY~eU|0HlNQ8rT6wTmRKoQ-o4;d$vqD(Bm2~W&RQOmkIF34 z@8GJd63k9tEyznN`s+!^Enx44+y<647h!30^q4df*r=?Csb5CdG(*#J2i4Y_pY zHBa0hJ*Yhn)lGr>3@Cg`pu(W`CF#vBpQrChoFMNT%b!$LfYa#qKdkF9WEOl6`1GDo z;P1@$4VzfU<3HSE%X+82GBanR z+P*hs;8ZS$goN?dG5Z@}Vs#5hTt3ximY;reQf`*K0a1LlhFjl{pR^y)@jbM1wp}x+D=IsJ+L(-VUN94THRDxkY{%Cpr)Mu;Q?UcunqaJ@jmwE9Kr#;YDxX`I)jI`o`d)}fc=hzVjGoHJfNQZZ znFY@Ih9s!m{`XIP`gDn<_$JW@8$KG%|9A2Ams=BlFR(~+!J2gSHMPbi9JH`XlS_UF zR!M*U!Wt0zNvY@Y#=?|2?(AigxUW!3eUr3^lRXnkET z9E}2_#ui^Jntm3tt=D1CU`6tLcb~JJYgWe^TjKlbUt}*IWEATIsAc6M#@Mw)+&hqX zIX2A_1gh`3muV*nB&+^Be9d_BrlsRD`P(Pve^y`1n#{8F--BY9r}t0Z^B7vD2!E7w zt;xSr%VX$p@Z%S!TO%0}=MU~dF)hqv&BSRI??AvaOt5(^rtix9{0st)x~=!mQF8_B zMebTb|NHrN>ji-WKkqXT1b6<-u|)UIG{#zs?{`>4BwA|d8l&nh;v1P!HAlmIj{GU# zW1gjqop9_wF>1oEc;~o>L|<=?+bPbs=#1KWO)w?dQ)eh|42`KtYt>9P?oq6gcV2Yr z`{!ZNH02=n@1kjD!TS@%>pZ9Gt?O0=M)0=x#f~ECs@vLIPxGJkJ>0f2jpY2GFJfJI zK0h{b+s2ucW6!mcYx>&HuEk)V9yGiA%0}+rh{M+JLSdiUzjBx38_TZ*w6jf*Yp(1Y zww1rVvwigX*+Q50z{LnF!RE;Pk!~^Ww4cr_6;;hrzuiQt`W0NL?-Esur=8OtgTg`aOwe1u3 zc`kKo9a-sYhOlNo)w}-m4^sH$j^_N)teW0k^?_>7%Q-Vc;@P07;U23smYS1AIeV>7 zS>esYZ|vQ0>d@f9?L+orUbEX$W;+_8>rr2&aj4C#wi&s8_HRMUDgWk;?JZ-L83A+LcK4+;Yt42%d8m}ra;8^y)hg7TbS&K> zgJy#+X^a@gw$Z*;^vU|gKKfQOR`L*w>{k=5i18GwP+nH8?)9^-@>vLROcLCddgUTP zV9<^A6a?JmuMXw+<-Ia*qfK0}8a$#-F3y=bI4Ziz+%R(E>|r^2r2GorT2N?s{cIfi zlSAEn!AsG=Jj0DvGr8h73wzS=!ig9it5Zzn&_YLJLBB{bFZl0#7pEoH&zfUOmsw^M zw<5OXM|#wkD|7n%?-sn`w;}7h9a!5ln9?|Q_sU`C*4f?pM-L2J2$M~42*O7Bm46E^ zh&HnyMpe&*jFMNBUlEOq0;?W8uo~t!BQ8JzO141@0t5R>v#px3S8W&?f11 z^4qY>GmlB-=gO{l-4OL+4=3L^ikP}4&94HH#dNq>usB=$-MqDV|N*IK$^ zMw`V@#2SzaX$>g8E_xs7G_~WEaW0x4iTIcdYm(J1oc;*QE2X~y_|IW z>LJ-8v^qTdRZA-`c)karj3C~!Z+K+X-2S{3DwOpFES8N*9jcvXmJu85nKqmoGAsE8 z&XkYxgxrvWTS&T8Pp-|GIV?P=%AN2U&O=@Pj&nhAB6p#!W}?OCzguQ_Q4oXp&Y7*F zE#KUiQf)AUc$F-W#o%PW%0MTEC!3-9S@&X*!(*)&B;Qyn2Ncf8G38)SK>3T1H%(NiB%A;? zi*N>58Z8IlsH9}zvk6DFJd`Q*>r<>qZ^uZ$&nD~wwt~RUhL zPRXAEXqk9Uci-?v;(&hkt6Alag=;gY*YQi;mZGORmH@k6u&%;>CXy&H0)bhgU5eFR zBo%~_*?1EW7IF805`PnlL5baR2cYLE9spaQ2$Sb!zoNBD4c2C0=2S?~(?OP(mPfre z3j-3KN%sPK5uFYa^2P2TfjOG4m;DOQ$y%^BLvYQ@7}y*WfbSOH2kl9fri%eWL4ca% zwdh|`tkiGEB7np-ssFL+=`3L+s77t&f@&rlF4zM)2lG>Jnk-Vx0UF!}dti~Hy!i>P z>IX_RC>kKn2M|rj1bKp1yy4mmc8(PKZ3>_8kjS7AMt}r;Q0w_R z$;&b8$m=SSWL&WxP(q4LKmbD|g99SZs%${Uz*rE-NLO}%Lm>|q0upu509Xu40gAGT zRIo?Nx#IbfUs$h$!L?WKRR@BjIjY{R;=`hpt6q<{>lTg((evC|I2v;; z3nXS~FZb*wjlI^+Q1xD|GxbW5*5|YGDrm&OB<%o!HAN{`DFHvsL*N-7(6&I*4gtf3 z81IL906bc@&dyMjmEM_p!h_{+XT%qwX@=$#G)rtim=6#uE}A^;f@E(APaLuk z@6rQR?%M$|M1VHfS&@OW9(66dNC)g~YK6p%Rid0TNY=$1R3A#Se;GhwV<4;10JMb& zfJbu_uB+i1;|tcB5}4_*P+Y&T&eizV8zW^FGHcSQWEztp6Tccwk;-Tm59Hfx}TX_qx z*(Q*^46s!!$o5(Y*xW_HP*;K!G+>94jzjh^)P4Zj9QVQzVh3c?76T&291z(kNDPBb zBtZ5<$hL=UKJ4THSSI0N^dyX4h0zcgO@>iv8qh*409xqfK#ObzwA4o+F#{6oq1g)A zV~}kK4HA~e7=RS^QkY_2lO~%HJHZehs43#05C#|#*B1z(4})~|0T|i3;=cz(YBqrL zlEQ|`Jy4x|5on-5O%XQ)2#eNRTFo@EvM#uFDo{QPJqV9Q>vPO}poz2;PsACs0&41Hyq!!0phIW%B zdwb*0w$VK1ePd&8Eci@jTQ7O5Ast*-s8QYi-A$v|o{^%KVwY;GL_8~6-o z5F0cDI>}g2OH>ZZ{GUO>9B4p(8$`tP^@SSY1ZaT6y9^p=_*LgShIJey5=J2BANg%sGpL{FH=go$gQcmvp-uoDn(V6)05cpw~jAOWB!p&>MQ*tY=o z&0YplFw0@yj}&w77#$rb!d=~D1byV)YgEV zQ#7z03^;ZqW(_dNt<<=0?0QtB-O&9}`yJTEy_~w!3~SUL)^BedoA{&rPq8N8tC#4G z#RVoOtG&+#d@T>$;cSlB$hL|M7)g@fxsx-!SU#|$4k5aUzEzz*JtN*22M?gFFHSa3 z{`Vc%EU%mFyVcBTKcVPT>=M>(W#=8@d76V}dn9`V+p3{dqi41YzxabL>E-_EG<(E* z18~a_>_G3`L8)pAZ2+zZ{DX}#7*=2@F2gGq-w7b)YmlQl_X!ts7u<0-^uJ?BZi9#C6K4aT4`1}x|U!by0@`2d&BV!#po;B15( z76kPnh=3s33V_@i0HQhps5rpURf)FR|4#$!i5b+*nqOci#jq1?3&&^Y)fD`ZdEhmB zY6p*@81QUON_aR7wU^JvF zR-~$>k<|cH7DCV+GL0b<{VxE~=K)D&x>-jh;vNHa$@4FR?QaEr2&gXrU%hB0%&+)w zQ8{~a!Cjr@0PbbH9W+Q_5CPzYF!%>}jYo#HS$}jD`+0(*0WgHA1}`S=>!qNR`27In z!6fQYK;?NY{7lB6H-PsD)lKjoF?aZX9E?ncnx0V8J_l&heW9k$e+5#!KwqL+_KB7e zWUJR^&fk* z@W=20pD`7KkEh8mcCI6tm|_!)C%-Ij5;-Tf4?Y*nTI>wR42u-oJhYocomP6w*@QiM z-b&KN72q?j;L*HGg3Cn)n@GrVTZNg%SFLbUgsp8tVs`$tiImj2wooR#KVQ2EiEv)9 ziNvnz202$l4VSYKWP5L=m^_|3EM3UgTF$0*9S5N|UGtW+m9n9P_P;J+?jnvWrbE7Y zsppo!tY2S#8bT|6snKc@C06QfBGDeLtkcmPB<)|biG(q=0F)bj3zxI&s|+`h}r=S)F_-0o)Yr%5I&LU-Vwc`p0E;_Y|OaY>NkScLS9Yr0> zE`N1twWV<>4(ETu3PUrCBFGutZX=w;at3kQKk29u;9iKy&&aw-^~0HbygzCZz~3N? zk_)?g&Szbd`tb+O<|_wdKy71x{`#|Z$_(h!{B$#snn(R8Fg$7MmY5C>@#_0YFPw!r z(VoT8grt!E@finsc1>o}#?}CjU=!3Is9$iU!=>#3UVJlIjF|qO;mCSMVAf1!&@8F9 z=bH&=?)?!TvGUsDsa*sdT3Qow$x9sP6>QA9N=@$n+RU4a^Wqa_=fwK&B@0+AYBJae zCLkKLLVY;3mEewUxe~s08;cs&JU)}DTD{eArQj9!m#`4oL()~#;1z<`V1XUUS2VoQ z%0vpbh9wULw-<-UA_#UEswq&3Jdx5Yo$csNdfJ9;@7*AC6mzyDY(VWM;hLW`GIIpk z+GYakvnw6VOp4%oW$=u}sH^EjW8zIgUgh5D0_9Ga9>)!G^c>+}tNpV?;}d9X*vx?P zLp8&eRY%45^fXJSXFGHQxsR$yz*nE%Oko& zLcx7vL05l?Y>|9Eonb?|qO1vWwm|!nBJAJF#MRiT)ylK-Bs#cfkY##ig0U0jA(_ zqpm%Vi&WZTnCHO}hOLTC9^%RRSH+HfBogYeSmGCXVnF@#e9{ADvneYht~I zoxaDLF9I)&ycdoLsy+F5MZ;z8HMUdlc=}rz%Rjw$zpO)i+&wl?xl&$cneYp#lr|r}aaMHc713NH&Olv8 zOCL&Dt-hnI8np- z2^-Z_nDoWTKarbwUg@qG?D2`>#+4sw^4ni3c++VthVx{IG9H7rkStVRtS>PHZ%5BU z+(weu$M^Zk_~O10H<6<3bJYV`-5@#yyi>>LAG25n-=-HPEK#!%nt90!G|&0R{?3^( zRy`|^FkaOpVr4eCf8Ly?ir*{1AaBD)wSI5 ze={4|)ARuFQIvHr3NwUhqvUMcp`YL4_g5ZnpB?0dMbs$Y6Ea=l;&K6}5C2Lu}>U~t# zROD>@djN6sP~ejVA?e$Dmd%cMLPSx9r6ctNCj)<<35c1puhKiamYj6WzVWbFn;hKY za|ts@@4EWjUH*sX6tUh1^`|NLr24SM{Ic;)TGi{G=lX5Dpood#Zt)!Dx245G^Uc*p zGgk;B;f#fMbMTDUUteHH@%Ghoxt$s@j>2y`TcE5GN?bybnxtC$#(?Rt38twEe97u1 zfzO?F=!)1*`NkCEq@o`ma?PD{-wDPadT>Y{bL_N z_qKrXy4yoJ>X42rXMcadD$PS^HPHgtKY>r^07tD$7&R7ruq*G}3AuA$CghFAGSvQ< z!5h_e-UbEbt5fPuph zI}419LCP}W^07I^VDJ}X5I;4M;MG&=t zLY+F`eg7ya0;IYuoQzfOlh>veWO-3A%X=Tl{t$C?>vWK(m*eJ=AWnr+d%WG<(g|{sh=$2hgdS z08p5{cTpj_2K0(Rt7?44e8-VH^fGWbW{x|AQKn+z#0;-s87i*(t5R%d| zjUOjdyDdR)rS2fbKOIPxElzzV4YbgS7gg_^H$E5{zW|)@_)m|L*?R$zl(p->5LE{M zD-ntQWgfVTPXnT|3lQaH&?G@N8OW;C7s1s=E(Gjdi&CFaFiU{;Ru`b1YzOl~U;znC zAp`A(m9UdHu#-E+AY}&vu#HS~;*lalu*`$Yt!R+!2^2y}cvw^olh1>C;&hNK%mVck zteTK~G+|zi>|Y1)4r+=sDT1!h~}hZ zz^E&VBEhHL^Kfvr2M(^_AXJzS*-XgBL$+WiBp!rBJ|s#Y(E`dkgNY<3F%u9) zaIPiT3W%ufkevwGKZasz$kv5yeaJS3Yy@PZw*Vr^7Z6>p0*njm{n!N>1p|MAfN~Vp zdkhrBbfigI)!RDY3$u@0S!D_Y!5}G5049gj zWH4L=>vCOkTV!%+`6c$`*4l3C5n8Jg4)95PK$sQqseG%KM)3g-;^L5a#R$ID7*6WY za8jqNfJ3wO;)Lbut3Rf8;xIV1yVB0ztaPP%f}tSMK?us#-qimt7=xq0{|AtQ$$^8$ zgK%CL4`+%_qab|;m{SVIj==OVsCgA?{&#}B$p36QkMQ4MYEo~*@q107+309D-mq6!t;_IvUO$ zU0_{wG4Pc2P|XmAk+uM27eTNJf_4z3K@js}`sNDL7NYr%?kV9JeN|?fjF-r z{Z=ZCVKS{NLO(z)OA#iU?-iFE@aKl{G)qkIFUVY3>tt>Qn_RicDZ^hQF>tdNueFaPmGTx zDLqP=A>U?Q)HPjv_4lMT^55nXE|BiFh~gUxGBB3txI9Ql0^6F8U>_v?exvE^A8Q7 zUL%;JV!Olcp92HoU}LcF@N<*fl)uSUu9D5_Y_IN6{yp#*oXi84fc=oS<~bq<-H**0 z%4(y2rWa4Q2uBoUrCGz$2|;A(kXL&-n8i}h5kW)jTUg8+a3wKZI(|BGRM0^e%|r^( zZ}ct+Hue*!QHJV*DE(Jl#qZ7=YvSC^1pHzHFqdetmqZ(8il#dM#0(=jS++s1S>G?Q zM@rRKX)49lz0HOy3w__-GpceH=KR|?p9Tckn4oAcU!OT~QjS}(@_E zT41UH#F;29%UB;gI{Uc&;jl>l&R5${^dKM{F@$I}3FxE9(#80a$zbJrxztaBQHIG4 zbW=;Dbo5)sOA|%EX;k6}_1qVu8o{^2-^KUNm!0~_4~buMV*MOgzB^xb5dA>J?OZ$Y z*6RyL-#2(aSUQuod(WXXB{)N6Fq_#88eo<(3Z_NGHNJe3%vju6l3GGRhZ^}dV3;w< zi!~nV7?40>mP{EcBdK-Ko|VSR;g;esE{WKKn-lpusqz^kbn>wk7^;}<3+tq75 zxzSyDG$y4)Dy3DbrgKJ--Jm$Rx_PkKd{oo}e5yB0rU&I;aB6d+(Q(rea#uPyG7*iw zcY2AqC1&cB%XPLlmNvXYUa=E9ooScplsMRs?hTvkp+vDP}&{!I5fk`Tu+SwNk$_lT*WQ&8N5`g0@SQypmNEfdp%CL;;A2_A!_cN)wSW#?kM zL@>SfdlpMD$rNFqa-K9wZ-9^OOz;P=sN#?Mtz?IOq%2kJYYbQ=Yryc>=o|RU0Ae64 zY}#GOoddJimbYQ-kLjG2Z$bJEe_cS2G=NcU5r!Y?Y(aHk(@elS#Q6rvg3#%tZo_S? z`UdXKFaO*pUi{YgJK-W)L}bh-fdLx|%&UW?;LkMdI%AN~KukcB{-$YA$*a(Rs83Kk z8ojQg2lThGFk`h~zRoTHN`gA*-VX=k@%{+GXAOw)?N>K@rOth3L_K}?H`T}Y}VyJ9=@CMYsqHDeyTiya!)nb%2aW0ungZqXysSW;_<(T!9N*`lXtrwbiC?Eeg|85GeG`8_-qU*LX^*sYPyWkAPu~ct z-=Vxa6+ux|aY+gIX=!v7cE((_>Nd{lZnZ|{8q3%_-KVZ?#ChJ$-=V%e#4sn_Km@<* z4`e$j6w+Qr*^6N1-ETqLCqDaY&e0mO1fReJHDLs0qPoqcvumjv(4VTdi$mhG1k6x2 zo~RjQHjdOj!%I576-k>`fUgwYhwu-EiGMQtcgPCFsUdDnoZz}L3wAKepK|b}Xr>fX zvtjj2gW5wX-#DNVZ9JHTm|k%jFD3dq_pA0v*KezvocX%ZCP5_^luqIOU#ut1H&x^~ zD<3IkWd-da!~-PXOpC@4;)jj93d-9Dl6R3>e{#+%81c|l8%dlJWACzAdYcmDS5`V} zllw(JmkTbVM*^O7Kl~#4EF5F#G=1g$c{2oUn=!^=Bf`T8smfl*x_bKzs`Lx^QXWF; zn^$*QNA)!k|1aIENFd}NtcjL!)V0f|jw)9m&u2Iqll=y}!%E}QF|%0aTiU<`X^Js` zBsJ0oYQ9Ey)dd7z#yziOZxB@KJxY|9s2FBmpPfUus~q*nJPc<3_<%s+N)|~qM3HL5 zSlQtGEUyYNP9O8rp?^JGwDeItCf*LX%g(Iwo?tx-irs+H92P8eP7R_s#p}==5QBPM z&!~|m-V@>-A#UZ0<&(^e)gm4%PNGY95YP~h;*$=VK8i3WHb&pQ? z*NG=ao8kmGe##aK;@$k4wIXkvTVApST|4}%Gs)chlQ^tDWsCG&v~K%R^+C86fipwfJVO@_ItyYaxZM8}7jV*J4wg z+z(P|kg6s@sxiz*;=vkKwG6~R9|C+_0U+_6K_nniJKTYL1{m5Go%W-lJUvi2%>i)i z;sJ>N48Xx&0M^$UZi-9l3g6+fky^hR2vv{(3HuEc#*`w!x(Kc(Byi1!>-j2B!)Y88 zW_h4NBlh1xInkgo(C0$xVMXc|>BQmrARcN8_@UtdOr}6m!2I_5AZ~X__qiwjrINAn z=V#|)Tm!P=(R(r!@iE%_kD~t7+jI)eTUq!@xT3%;mxOPuZ`Zr z;+{i=uT)1Ir^EWD1z|g^23xbjPdYjCn@Pq&DPl=-&!3Gm2ZgmO3+shgrk2p&D_%!v zZ|s~ZmP`N*rVAe!!r6`9gW}vnh4reZjG2+!V$rFCSt=u- z#o3m=FrJ<`s^?2boBQQ98ec~Qh41~S&k;P)DG5RyE9~|rq_=BUN0CR;+v?``eLoMX zsJj!i6zV17`{0{Xt|nC1mrmGk@7+zhN@wVYPAiT?p3fVpRF>@oHEFy)KKP5O|D0pm zZRb6#vNa$bz%nZqj6lQjn)zswVRnc;pxacIFegpXc!j>g?C`-kcvimq~=-l|-k zkHZ_x9FXs9#BK3An=6nGIWF@W#T)6{2BT`4%#MtW$%1f|j>@C#H};H`q`Pdd%jH>A zq@be7u^Idxdhk#FkV$)Dl(ua!>+t1+O~_nL0h4^>1*KIn>)(u=ixbtPj16x|@+&ra ziImoUSm?{BXLMd14*0&6ADt=lW99BlZI@u*NAFOY$!!aIGB6V@g6L(_6QjRT{C>Vn zlh*d=`7#8Z4uw^!-jj53xi5oz>)-A#%z@S{2c4WLUc~}mhLZQM>T!E6_jBclZ=aZV zF4mG%s-&$6z9g^~P10wUC;ovdH+d8*?`)9R4vt8l@m7vBpzbST&HM((Frw-v*-=bb zTo|Nw$A+~4Mc>ajAJ#ms5GObYde#aq{ zB>4+f_A6sqTt7a2$oTu*=3u=zjU}}+-25N(WZbhwXP%-J;f0MVRBriV@_|8LMuhSd zl^KqGL7gT(fl&;Mnj-nyvco7eRU((aX3x%kmIYF&O2k094Rfz_jW2Vu=2zxmsb;-^MYe_^~JIL6dAa?m^jELS-b=a$7`` zZ%4({{uFBp_1)rawcNUd!ZxCDl>Y4xVDdjwU+YN*&5Nz47gs_>Y3@SLpVZGdh_L2>wFfX9RDPw_jN5 zXDNrIb3DB>&uDCi!cJA*7oD9UtUo~rrC$d^ft@gv2|^7{kh(H>@tJ4RV`vbUDpC(o zXnn?D{X1NHfweTL3#=3W1ncOIK2l+)&|Iop;2@|+d_E&Tsd6jkNI&a?0s(*^{w*BD zCvJi)9tB8w*+C|A(V25W++fG@v2yG3Fa@T8@k^Y!{LvQ*0?-PxL_WxURQQyu)5np_V=x#m;H@IcOqx0LcA& zsx2iw9FVEG;P)sOl%-X~%)O*NJJ9!Y$=uHsPrJEMF;ZXKqmea<(!p&{%Zl^4<{Rot z6%OBn6Ub6k7jtsxYkD-kL9x{)pC<4}lDCFmp5u?J4j-1BCj~bs**1j@LQfz69(*YU zaag;CseEnV?8z<{vcA5jZp@a3(I9u}}B3$W) zv7buVxlF!RPM=~dK=)=959AJ|w<`GMuM=(3+v}S9tjkgw3A-|@%fbIin&PDFlD54! zUjB@rAvym<{aSs05%ACUt*c)vsD^Hg>83OCvGBsTLP5^dUgauGUd#7(m#>1H9j>Us zfQUcXG|{~BCxa*Z$A9lD7)bOPsj90JJ!}d$PC)O=m~izn1|QQr|3C{Y{vp|ah4--f zre7eMbeqXs{<<3+(6+iapDLMGRB2Qptxao#12s=?|A(=#9#Rwc8r2&FT^>~% zln7nq**mdsxfQMX02UWbQ0{MLgM~y}^N8_2$zEMRx8{b-=VI(TLZ# zOSwhv94}czs#T)r9D~t~>jcRQKnIhHDzP)AN_ot@{U0Jv-p`rAjw-hC?-5K+mlO6> z7hJ)NO_X%&+`T*@Tv6_yCiuwRUFtXD)E*G42fl{XbYC2*7XDG1`D(0nFH>iO10D;y zF7;tauM+#^eDG!pJFAsR}gnI^Eid{O7w0M-+RdcO!g6+W2XzSNpUIWR#a25KQUx@}PC=3jlId9ZMipAqCy`wi7w}_k)z@jI zj?N3nfu!B$-eY2H|D=P`PwtA7SgCI#G)L@a2VU%wo^rff`|TN_^Ay8WeUZRF#V}Vt z6!j-5LeX>wYIiixCl9YU@U=!Tov0)>^PNW?$5Hb}aHgzQ#eKs^aq^E2=6|zAaV+4I z9qVEbD%}ORy4Wr1Yv{wvCf_gYs#TUObTrqzij>V$=wK$P&hP%s=&B{;WH9X2dFcFQ zIBRvSh`4O(q|#7Ry{sIed9Rr)@ej?}DW&D-WbTx58@g9chlrfSm9CD5*f*N9s#|)x zL`BzV1G+%_Datuj^gDUl^yzBQ3njep4bkXk>Q3nv8@`upsfbZ!-$IrIsxEWKF+_h6 z>8vsz;bxdU60PF)sD_X-0UP-Vn3jiYNGCPzua}l zDTu2Lx)|Kq<8C;`_UOuOv^Cl9xPQ^L==Rheoh}B!&BU8;Y7uwq-9~>gRsW0{@#@2a K`PO7Dt^WlY&rD k iff the customer + at server j is blocked from entering the node that + contains k. + """ + def __init__(self): + """ + Initialises the state digraph detection mechanism class + """ + self.statedigraph = nx.DiGraph() + + def initialise_at_node(self, node): + """ + Initialises the state digraph when the node is created. + Adds the servers of that node if c < Inf. + """ + if node.c < 'Inf': + self.statedigraph.add_nodes_from([str(s)for s in node.servers]) + + def detect_deadlock(self): + """ + Detects whether the system is in a deadlocked state, + that is, is there a knot. Note that this code is taken + and adapted from the NetworkX Developer Zone Ticket + #663 knot.py (09/06/2015) + """ + knots = [] + for subgraph in nx.strongly_connected_component_subgraphs(self.statedigraph): + nodes = set(subgraph.nodes()) + if len(nodes) == 1: + n = nodes.pop() + nodes.add(n) + if set(self.statedigraph.successors(n)) == nodes: + knots.append(subgraph) + else: + for n in nodes: + successors = nx.descendants(self.statedigraph, n) + if successors <= nodes: + knots.append(subgraph) + break + if len(knots) > 0: + return True + return False + + def action_at_attach_server(self, node, server, individual): + """ + The action taken at the 'attach_server' method of the node. + """ + for blq in node.blocked_queue: + inds = [ind for ind in node.simulation.nodes[ + blq[0]].individuals if ind.id_number == blq[1]] + ind = inds[0] + if ind != individual: + self.statedigraph.add_edge( + str(ind.server), str(server)) + + def action_at_blockage(self, individual, next_node): + """ + The action takn at the 'block_individual' method of the node. + """ + for svr in next_node.servers: + self.statedigraph.add_edge( + str(individual.server), str(svr)) + + def action_at_detach_server(self, server): + """ + The action taken at the 'detatch_server' method of the node. + """ + self.statedigraph.remove_edges_from( + self.statedigraph.in_edges( + str(server)) + self.statedigraph.out_edges( + str(server))) diff --git a/ciw/node.py b/ciw/node.py index 6c246a5d..e5023302 100644 --- a/ciw/node.py +++ b/ciw/node.py @@ -54,9 +54,7 @@ def __init__(self, id_, simulation): self.blocked_queue = [] if self.c < 'Inf': self.servers = [Server(self, i + 1) for i in xrange(self.c)] - if simulation.detecting_deadlock: - self.simulation.digraph.add_nodes_from([str(s) - for s in self.servers]) + self.simulation.deadlock_detector.initialise_at_node(self) self.highest_id = 0 def __repr__(self): @@ -93,15 +91,8 @@ def attach_server(self, server, individual): server.cust = individual server.busy = True individual.server = server - - if self.simulation.detecting_deadlock: - for blq in self.blocked_queue: - inds = [ind for ind in self.simulation.nodes[ - blq[0]].individuals if ind.id_number==blq[1]] - ind = inds[0] - if ind != individual: - self.simulation.digraph.add_edge( - str(ind.server), str(server)) + self.simulation.deadlock_detector.action_at_attach_server( + self, server, individual) def begin_service_if_possible_accept(self, next_individual, @@ -159,10 +150,8 @@ def block_individual(self, individual, next_node): individual.customer_class) next_node.blocked_queue.append( (self.id_number, individual.id_number)) - if self.simulation.detecting_deadlock: - for svr in next_node.servers: - self.simulation.digraph.add_edge( - str(individual.server), str(svr)) + self.simulation.deadlock_detector.action_at_blockage( + individual, next_node) def change_customer_class(self,individual): """ @@ -214,13 +203,8 @@ def detatch_server(self, server, individual): server.cust = False server.busy = False individual.server = False - - if self.simulation.detecting_deadlock: - self.simulation.digraph.remove_edges_from( - self.simulation.digraph.in_edges( - str(server)) + self.simulation.digraph.out_edges( - str(server))) - + self.simulation.deadlock_detector.action_at_detach_server( + server) if server.offduty: self.kill_server(server) diff --git a/ciw/simulation.py b/ciw/simulation.py index 33c00294..249206c5 100644 --- a/ciw/simulation.py +++ b/ciw/simulation.py @@ -7,7 +7,6 @@ from decimal import Decimal, getcontext import yaml -import networkx as nx import numpy.random as nprandom from node import Node @@ -18,6 +17,7 @@ from individual import Individual from data_record import DataRecord from state_tracker import * +from deadlock_detector import * class Simulation: """ @@ -43,8 +43,7 @@ def __init__(self, *args, **kwargs): self.name = self.parameters['Name'] self.c = self.parameters['Number_of_servers'] self.number_of_nodes = self.parameters['Number_of_nodes'] - self.detecting_deadlock = self.parameters['Detect_deadlock'] - self.digraph = nx.DiGraph() + self.deadlock_detector = self.choose_deadlock_detection() self.lmbda = [self.parameters['Arrival_distributions'][ 'Class ' + str(i)] for i in xrange(self.parameters[ 'Number_of_classes'])] @@ -151,7 +150,7 @@ def check_valid_parameters(self): if x != 'Inf': if x not in self.parameters: raise ValueError('Number_of_servers must be list of positive integers or valid server schedules.') - if not isinstance(self.parameters['Detect_deadlock'], bool): + if self.parameters['Detect_deadlock'] not in set([False, 'StateDigraph']): raise ValueError('Detect_deadlock must be a boolean.') if len(self.parameters['Queue_capacities']) != self.parameters['Number_of_nodes']: raise ValueError('Queue_capacities must be list of length Number_of_nodes.') @@ -283,31 +282,16 @@ def choose_tracker(self): elif self.parameters['Detect_deadlock']: return NaiveTracker(self) return StateTracker(self) - - def detect_deadlock(self): - """ - Detects whether the system is in a deadlocked state, - that is, is there a knot. Note that this code is taken - and adapted from the NetworkX Developer Zone Ticket - #663 knot.py (09/06/2015) - """ - knots = [] - for subgraph in nx.strongly_connected_component_subgraphs(self.digraph): - nodes = set(subgraph.nodes()) - if len(nodes) == 1: - n = nodes.pop() - nodes.add(n) - if set(self.digraph.successors(n)) == nodes: - knots.append(subgraph) - else: - for n in nodes: - successors = nx.descendants(self.digraph, n) - if successors <= nodes: - knots.append(subgraph) - break - if len(knots) > 0: - return True - return False + + def choose_deadlock_detection(self): + """ + Chooses the deadlock detection mechanism to use for the + simulation. + """ + if self.parameters['Detect_deadlock'] == False: + return NoDeadlockDetection() + if self.parameters['Detect_deadlock'] == 'StateDigraph': + return StateDigraphMethod() def find_distributions(self, n, c, source): """ @@ -441,7 +425,7 @@ def simulate_until_deadlock(self): self.times_dictionary[current_state] = current_time for node in self.transitive_nodes: node.update_next_event_date(current_time) - deadlocked = self.detect_deadlock() + deadlocked = self.deadlock_detector.detect_deadlock() if deadlocked: time_of_deadlock = current_time next_active_node = self.find_next_active_node() diff --git a/ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml b/ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml index 4e070192..d2f0960d 100644 --- a/ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml +++ b/ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml @@ -4,7 +4,7 @@ Arrival_distributions: - 35.0 - - Exponential - 35.0 -Detect_deadlock: True +Detect_deadlock: 'StateDigraph' Number_of_classes: 1 Number_of_nodes: 2 Number_of_servers: diff --git a/ciw/tests/test_node.py b/ciw/tests/test_node.py index cf26cec3..ac344962 100644 --- a/ciw/tests/test_node.py +++ b/ciw/tests/test_node.py @@ -170,11 +170,11 @@ def test_block_individual_method(self): N2.accept(inds[6], 2) self.assertEqual(inds[6].is_blocked, False) self.assertEqual(N1.blocked_queue, []) - self.assertEqual(Q.digraph.edges(), []) + self.assertEqual(Q.deadlock_detector.statedigraph.edges(), []) N2.block_individual(inds[6], N1) self.assertEqual(inds[6].is_blocked, True) [(2, 7)] - self.assertEqual(Q.digraph.edges(), + self.assertEqual(Q.deadlock_detector.statedigraph.edges(), [('Server 1 at Node 2', 'Server 2 at Node 1'), ('Server 1 at Node 2', 'Server 5 at Node 1'), ('Server 1 at Node 2', 'Server 3 at Node 1'), @@ -211,7 +211,7 @@ def test_begin_service_if_possible_release_method(self): ind = Q.transitive_nodes[0].individuals[0] ind.service_time = 3.14 ind.arrival_date = 100.0 - self.assertEqual(Q.digraph.nodes(), + self.assertEqual(Q.deadlock_detector.statedigraph.nodes(), ['Server 5 at Node 2', 'Server 5 at Node 1', 'Server 3 at Node 2', @@ -373,7 +373,7 @@ def test_begin_service_if_possible_accept_method(self): Q = ciw.Simulation(ciw.load_parameters( 'ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml')) ind = ciw.Individual(1) - self.assertEqual(Q.digraph.nodes(), + self.assertEqual(Q.deadlock_detector.statedigraph.nodes(), ['Server 5 at Node 2', 'Server 5 at Node 1', 'Server 3 at Node 2', diff --git a/ciw/tests/test_simulation.py b/ciw/tests/test_simulation.py index 71b7e516..2a42b90c 100644 --- a/ciw/tests/test_simulation.py +++ b/ciw/tests/test_simulation.py @@ -7,6 +7,7 @@ import copy from numpy import random as nprandom from decimal import Decimal +import networkx as nx def set_seed(x): @@ -507,35 +508,38 @@ def test_simulate_until_deadlock_method(self): def test_detect_deadlock_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml')) nodes = ['A', 'B', 'C', 'D', 'E'] connections = [('A', 'D'), ('A', 'B'), ('B', 'E'), ('C', 'B'), ('E', 'C')] + Q.deadlock_detector.statedigraph = nx.DiGraph() for nd in nodes: - Q.digraph.add_node(nd) + Q.deadlock_detector.statedigraph.add_node(nd) for cnctn in connections: - Q.digraph.add_edge(cnctn[0], cnctn[1]) - self.assertEqual(Q.detect_deadlock(), True) + Q.deadlock_detector.statedigraph.add_edge(cnctn[0], cnctn[1]) + self.assertEqual(Q.deadlock_detector.detect_deadlock(), True) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml')) nodes = ['A', 'B', 'C', 'D'] connections = [('A', 'B'), ('A', 'C'), ('B', 'C'), ('B', 'D')] + Q.deadlock_detector.statedigraph = nx.DiGraph() for nd in nodes: - Q.digraph.add_node(nd) + Q.deadlock_detector.statedigraph.add_node(nd) for cnctn in connections: - Q.digraph.add_edge(cnctn[0], cnctn[1]) - self.assertEqual(Q.detect_deadlock(), False) + Q.deadlock_detector.statedigraph.add_edge(cnctn[0], cnctn[1]) + self.assertEqual(Q.deadlock_detector.detect_deadlock(), False) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml')) nodes = ['A', 'B'] + Q.deadlock_detector.statedigraph = nx.DiGraph() for nd in nodes: - Q.digraph.add_node(nd) - self.assertEqual(Q.detect_deadlock(), False) + Q.deadlock_detector.statedigraph.add_node(nd) + self.assertEqual(Q.deadlock_detector.detect_deadlock(), False) connections = [('A', 'A')] for cnctn in connections: - Q.digraph.add_edge(cnctn[0], cnctn[1]) - self.assertEqual(Q.detect_deadlock(), True) + Q.deadlock_detector.statedigraph.add_edge(cnctn[0], cnctn[1]) + self.assertEqual(Q.deadlock_detector.detect_deadlock(), True) def test_mm1_from_file(self): Q = ciw.Simulation(ciw.load_parameters( From 314e6cad78bd60d33d3cc95598288500b23bd967 Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Fri, 8 Apr 2016 15:47:44 +0100 Subject: [PATCH 02/20] fix docs to reflect recent deadlock change --- docs/Features/deadlock.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Features/deadlock.rst b/docs/Features/deadlock.rst index 72001360..2e6fd6d4 100644 --- a/docs/Features/deadlock.rst +++ b/docs/Features/deadlock.rst @@ -8,7 +8,7 @@ Ciw's has built in deadlock detection capability. With Ciw, a queueing network c In order to take advantage of this feature, set deadlock detection option to True in the parameters file:: - Detect_deadlock: True + Detect_deadlock: StateDigraph Then use the :code:`simulate_until_deadlock` method. The attribute :code:`times_to_deadlock` contains the times to deadlock from each state:: @@ -31,7 +31,7 @@ Parameters:: >>> params = {'Arrival_distributions': {'Class 0': [['Exponential', 6.0]]}, ... 'Number_of_nodes': 1, - ... 'Detect_deadlock': True, + ... 'Detect_deadlock': 'StateDigraph', ... 'Number_of_servers': [1], ... 'Queue_capacities': [3], ... 'Number_of_classes': 1, From 4b2daf4fcc03b6d2c32bfa06073a71f878ba2569 Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Mon, 18 Apr 2016 13:42:09 +0100 Subject: [PATCH 03/20] simulate_until_max_time takes in argument, tests break --- ciw/simulation.py | 4 ++-- ciw/tests/test_simulation.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ciw/simulation.py b/ciw/simulation.py index 33c00294..a962f5fc 100644 --- a/ciw/simulation.py +++ b/ciw/simulation.py @@ -450,7 +450,7 @@ def simulate_until_deadlock(self): time_of_deadlock - self.times_dictionary[state] for state in self.times_dictionary.keys()} - def simulate_until_max_time(self): + def simulate_until_max_time(self, max_simulation_time): """ Runs the simulation until max_simulation_time is reached. """ @@ -458,7 +458,7 @@ def simulate_until_max_time(self): self.nodes[0].update_next_event_date() next_active_node = self.find_next_active_node() current_time = next_active_node.next_event_date - while current_time < self.max_simulation_time: + while current_time < max_simulation_time: next_active_node.have_event() for node in self.transitive_nodes: node.update_next_event_date(current_time) diff --git a/ciw/tests/test_simulation.py b/ciw/tests/test_simulation.py index 39576732..95f60159 100644 --- a/ciw/tests/test_simulation.py +++ b/ciw/tests/test_simulation.py @@ -483,7 +483,7 @@ def test_simulate_until_max_time_method(self): set_seed(2) Q = ciw.Simulation(ciw.load_parameters( 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) - Q.simulate_until_max_time() + Q.simulate_until_max_time(150) L = Q.get_all_individuals() self.assertEqual(round( L[300].data_records.values()[0][0].service_start_date, 8), 8.89002862) @@ -491,7 +491,7 @@ def test_simulate_until_max_time_method(self): set_seed(60) Q = ciw.Simulation(ciw.load_parameters( 'ciw/tests/datafortesting/logs_test_for_dynamic_classes/parameters.yml')) - Q.simulate_until_max_time() + Q.simulate_until_max_time(50) L = Q.get_all_individuals() drl = [] for dr in L[0].data_records[1]: From 898d30da10778a911ec3cbdba7c87d683a253a92 Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Mon, 18 Apr 2016 13:55:46 +0100 Subject: [PATCH 04/20] rip out simulation_time, some tests pass, error with masterschedule --- ciw/simulation.py | 10 ---------- ciw/tests/test_arrival_node.py | 3 +-- ciw/tests/test_simulation.py | 31 +++++++------------------------ 3 files changed, 8 insertions(+), 36 deletions(-) diff --git a/ciw/simulation.py b/ciw/simulation.py index a962f5fc..eb076d71 100644 --- a/ciw/simulation.py +++ b/ciw/simulation.py @@ -115,15 +115,6 @@ def build_parameters(self, params): params[a] = params.get(a, default_dict[a]) return params - def check_simulation_time(self): - """ - Raises errors if there is an invalide simulation time - """ - if self.parameters['Simulation_time'] is None: - raise ValueError('Simulation_time not set.') - if self.parameters['Simulation_time'] <= 0: - raise ValueError('Simulation_time must be a positive number.') - def check_userdef_dist(self, func): """ Safely sample from a user defined distribution @@ -454,7 +445,6 @@ def simulate_until_max_time(self, max_simulation_time): """ Runs the simulation until max_simulation_time is reached. """ - self.check_simulation_time() self.nodes[0].update_next_event_date() next_active_node = self.find_next_active_node() current_time = next_active_node.next_event_date diff --git a/ciw/tests/test_arrival_node.py b/ciw/tests/test_arrival_node.py index 321ce304..31523d6f 100644 --- a/ciw/tests/test_arrival_node.py +++ b/ciw/tests/test_arrival_node.py @@ -124,11 +124,10 @@ def test_rejection_dict(self): params = {'Arrival_distributions':[['Deterministic', 3.0], ['Deterministic', 4.0]], 'Service_distributions':[['Deterministic', 10.0], ['Deterministic', 10.0]], 'Transition_matrices':[[0.0, 1.0], [0.0, 0.0]], - 'Simulation_time': 20, 'Number_of_servers':[1, 1], 'Queue_capacities':[1, 1]} Q = ciw.Simulation(params) self.assertEqual(Q.rejection_dict, {1: {0: []}, 2: {0:[]}}) - Q.simulate_until_max_time() + Q.simulate_until_max_time(20) self.assertEqual(Q.rejection_dict, {1: {0: [9.0, 12.0, 18.0]}, 2: {0:[12.0, 16.0]}}) diff --git a/ciw/tests/test_simulation.py b/ciw/tests/test_simulation.py index 95f60159..faaf51b3 100644 --- a/ciw/tests/test_simulation.py +++ b/ciw/tests/test_simulation.py @@ -8,7 +8,6 @@ from numpy import random as nprandom from decimal import Decimal - def set_seed(x): seed(x) nprandom.seed(x) @@ -554,7 +553,7 @@ def test_mminf_node(self, arrival_rate, service_rate, Simulation_time, rm): 'Transition_matrices': [[0.0]]} Q = ciw.Simulation(params) - Q.simulate_until_max_time() + Q.simulate_until_max_time(Simulation_time) inds = Q.get_all_individuals() waits = [ind.data_records[1][0].wait for ind in inds] self.assertEqual(sum(waits), 0.0) @@ -616,12 +615,6 @@ def test_raising_errors(self): self.assertRaises(ValueError, ciw.Simulation, params_list[18]) params_list[19]['Transition_matrices']['Class 0'] = [[1.4]] self.assertRaises(ValueError, ciw.Simulation, params_list[19]) - params_list[20]['Simulation_time'] = -2000 - Q = ciw.Simulation(params_list[20]) - self.assertRaises(ValueError, Q.simulate_until_max_time,) - del(params_list[21]['Simulation_time']) - Q = ciw.Simulation(params_list[21]) - self.assertRaises(ValueError, Q.simulate_until_max_time,) params_list[22]['Class_change_matrices'] = {'Node 0':[[0.0]], 'Node 1':[[0.0]]} self.assertRaises(ValueError, ciw.Simulation, params_list[22]) @@ -639,8 +632,7 @@ def test_raising_errors(self): def test_writing_data_files(self): Q = ciw.Simulation(ciw.load_parameters( 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) - Q.max_simulation_time = 50 - Q.simulate_until_max_time() + Q.simulate_until_max_time(50) files = [x for x in os.walk( 'ciw/tests/datafortesting/logs_test_for_simulation/')][0][2] self.assertEqual('data.csv' in files, False) @@ -653,8 +645,7 @@ def test_writing_data_files(self): Q = ciw.Simulation(ciw.load_parameters( 'ciw/tests/datafortesting/logs_test_for_mm1/parameters.yml')) - Q.max_simulation_time = 50 - Q.simulate_until_max_time() + Q.simulate_until_max_time(50) files = [x for x in os.walk( 'ciw/tests/datafortesting/logs_test_for_mm1/')][0][2] self.assertEqual('data_1.csv' in files, False) @@ -674,14 +665,12 @@ def test_simultaneous_events_example(self): Arrival_distributions = [['Deterministic', 10.0], 'NoArrivals'] Service_distributions = [['Deterministic', 5.0], ['Deterministic', 5.0]] Transition_matrices = [[1.0, 0.0], [0.0, 0.0]] - Simulation_time = 36 Number_of_servers = [2, 1] Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, Service_distributions = Service_distributions, Transition_matrices = Transition_matrices, - Simulation_time = Simulation_time, Number_of_servers = Number_of_servers) - Q.simulate_until_max_time() + Q.simulate_until_max_time(36) inds = Q.get_all_individuals() recs = Q.get_all_records() self.assertEqual(len(inds), 2) @@ -692,14 +681,12 @@ def test_simultaneous_events_example(self): Arrival_distributions = [['Deterministic', 10.0], 'NoArrivals'] Service_distributions = [['Deterministic', 5.0], ['Deterministic', 5.0]] Transition_matrices = [[1.0, 0.0], [0.0, 0.0]] - Simulation_time = 36 Number_of_servers = [2, 1] Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, Service_distributions = Service_distributions, Transition_matrices = Transition_matrices, - Simulation_time = Simulation_time, Number_of_servers = Number_of_servers) - Q.simulate_until_max_time() + Q.simulate_until_max_time(36) inds = Q.get_all_individuals() recs = Q.get_all_records() self.assertEqual(len(inds), 3) @@ -710,18 +697,16 @@ def test_exactness(self): Arrival_distributions = [['Exponential', 20]] Service_distributions = [['Deterministic', 0.01]] Transition_matrices = [[0.0]] - Simulation_time = 10 Number_of_servers = ['server_schedule'] Cycle_length = 3 server_schedule = [[0.0, 0], [0.5, 1], [0.55, 0]] Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, Service_distributions = Service_distributions, Transition_matrices = Transition_matrices, - Simulation_time = Simulation_time, Number_of_servers = Number_of_servers, Cycle_length = Cycle_length, server_schedule = server_schedule) - Q.simulate_until_max_time() + Q.simulate_until_max_time(10) recs = Q.get_all_records(headers = False) mod_service_starts = [obs%Cycle_length for obs in [r[5] for r in recs]] self.assertNotEqual(set(mod_service_starts), set([0.50, 0.51, 0.52, 0.53, 0.54])) @@ -730,19 +715,17 @@ def test_exactness(self): Arrival_distributions = [['Exponential', 20]] Service_distributions = [['Deterministic', 0.01]] Transition_matrices = [[0.0]] - Simulation_time = 10 Number_of_servers = ['server_schedule'] Cycle_length = 3 server_schedule = [[0.0, 0], [0.5, 1], [0.55, 0]] Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, Service_distributions = Service_distributions, Transition_matrices = Transition_matrices, - Simulation_time = Simulation_time, Number_of_servers = Number_of_servers, Cycle_length = Cycle_length, server_schedule = server_schedule, Exact = 14) - Q.simulate_until_max_time() + Q.simulate_until_max_time(10) recs = Q.get_all_records(headers=False) mod_service_starts = [obs%Cycle_length for obs in [r[5] for r in recs]] expected_set = set([Decimal(k) for k in ['0.50', '0.51', '0.52', '0.53', '0.54']]) From 7aa68b4944f7bf7bc97d8d3016f84268f2bc68e3 Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Mon, 18 Apr 2016 14:03:58 +0100 Subject: [PATCH 05/20] more stripping out Simtulation_time --- .../29d64452f36fbdaf/0a4e40cf174cc33f | Bin 0 -> 33 bytes .../29d64452f36fbdaf/2a460755cd3552ec | Bin 0 -> 33 bytes .../29d64452f36fbdaf/310b6fe2a7d2e397 | Bin 0 -> 33 bytes .../29d64452f36fbdaf/4b1b22fcd376699a | Bin 0 -> 33 bytes .../29d64452f36fbdaf/56d2b74af375f9c5 | Bin 0 -> 33 bytes .../29d64452f36fbdaf/800209280d8e6594 | Bin 0 -> 33 bytes .../29d64452f36fbdaf/84e4c3ba021aa616 | Bin 0 -> 33 bytes .../29d64452f36fbdaf/94eb3cb9deacb94c | Bin 0 -> 33 bytes .../29d64452f36fbdaf/a02d9438b36b1807 | Bin 0 -> 33 bytes .../29d64452f36fbdaf/ac569ea775eac75b | Bin 41 -> 0 bytes .../29d64452f36fbdaf/ca44bc385400f812 | Bin 0 -> 33 bytes .../29d64452f36fbdaf/dae8a428c24551c7 | Bin 0 -> 33 bytes .../29d64452f36fbdaf/eb52399909c76bb8 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/0c34bf18bcc77dff | Bin 0 -> 33 bytes .../3a76e75eadfd834a/10da0065875f760f | Bin 0 -> 33 bytes .../3a76e75eadfd834a/16724dec504c946a | Bin 0 -> 33 bytes .../3a76e75eadfd834a/196e9ceb92a5d0d4 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/3627143134e9468d | Bin 0 -> 33 bytes .../3a76e75eadfd834a/367696b95d1f505f | Bin 0 -> 33 bytes .../3a76e75eadfd834a/475b08c9b98e8c5f | Bin 0 -> 33 bytes .../3a76e75eadfd834a/4b1b22fcd376699a | Bin 0 -> 33 bytes .../3a76e75eadfd834a/66cfbc7b8ff84a3b | Bin 0 -> 33 bytes .../3a76e75eadfd834a/71b60761307aa33f | Bin 0 -> 33 bytes .../3a76e75eadfd834a/8e7029315174e1ec | Bin 0 -> 33 bytes .../3a76e75eadfd834a/b66f89ef26caa2be | Bin 0 -> 33 bytes .../3a76e75eadfd834a/e322d867ec35d11a | Bin 0 -> 33 bytes ciw/simulation.py | 2 -- ciw/tests/test_simulation.py | 24 +----------------- 28 files changed, 1 insertion(+), 25 deletions(-) create mode 100644 .hypothesis/examples/29d64452f36fbdaf/0a4e40cf174cc33f create mode 100644 .hypothesis/examples/29d64452f36fbdaf/2a460755cd3552ec create mode 100644 .hypothesis/examples/29d64452f36fbdaf/310b6fe2a7d2e397 create mode 100644 .hypothesis/examples/29d64452f36fbdaf/4b1b22fcd376699a create mode 100644 .hypothesis/examples/29d64452f36fbdaf/56d2b74af375f9c5 create mode 100644 .hypothesis/examples/29d64452f36fbdaf/800209280d8e6594 create mode 100644 .hypothesis/examples/29d64452f36fbdaf/84e4c3ba021aa616 create mode 100644 .hypothesis/examples/29d64452f36fbdaf/94eb3cb9deacb94c create mode 100644 .hypothesis/examples/29d64452f36fbdaf/a02d9438b36b1807 delete mode 100644 .hypothesis/examples/29d64452f36fbdaf/ac569ea775eac75b create mode 100644 .hypothesis/examples/29d64452f36fbdaf/ca44bc385400f812 create mode 100644 .hypothesis/examples/29d64452f36fbdaf/dae8a428c24551c7 create mode 100644 .hypothesis/examples/29d64452f36fbdaf/eb52399909c76bb8 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/0c34bf18bcc77dff create mode 100644 .hypothesis/examples/3a76e75eadfd834a/10da0065875f760f create mode 100644 .hypothesis/examples/3a76e75eadfd834a/16724dec504c946a create mode 100644 .hypothesis/examples/3a76e75eadfd834a/196e9ceb92a5d0d4 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/3627143134e9468d create mode 100644 .hypothesis/examples/3a76e75eadfd834a/367696b95d1f505f create mode 100644 .hypothesis/examples/3a76e75eadfd834a/475b08c9b98e8c5f create mode 100644 .hypothesis/examples/3a76e75eadfd834a/4b1b22fcd376699a create mode 100644 .hypothesis/examples/3a76e75eadfd834a/66cfbc7b8ff84a3b create mode 100644 .hypothesis/examples/3a76e75eadfd834a/71b60761307aa33f create mode 100644 .hypothesis/examples/3a76e75eadfd834a/8e7029315174e1ec create mode 100644 .hypothesis/examples/3a76e75eadfd834a/b66f89ef26caa2be create mode 100644 .hypothesis/examples/3a76e75eadfd834a/e322d867ec35d11a diff --git a/.hypothesis/examples/29d64452f36fbdaf/0a4e40cf174cc33f b/.hypothesis/examples/29d64452f36fbdaf/0a4e40cf174cc33f new file mode 100644 index 0000000000000000000000000000000000000000..09acad8bcfb8646292f245eb7954bd16f77d4397 GIT binary patch literal 33 ecmcEDIdkUB{SJ0g4Gd7ww1_Qa+V08rPzeCQKnwi< literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/29d64452f36fbdaf/2a460755cd3552ec b/.hypothesis/examples/29d64452f36fbdaf/2a460755cd3552ec new file mode 100644 index 0000000000000000000000000000000000000000..d49a221821ce7368bb9373cc7e2ccb875e7e9d1b GIT binary patch literal 33 ecmcED@8IAd=3pn)zyJkJi`YV@?VfB8l>h*UG6&Ygh>DZ$l(f3 diff --git a/.hypothesis/examples/29d64452f36fbdaf/ca44bc385400f812 b/.hypothesis/examples/29d64452f36fbdaf/ca44bc385400f812 new file mode 100644 index 0000000000000000000000000000000000000000..a6c0b1122396373dca31e6e7407244e4af4db0dd GIT binary patch literal 33 ecmcEDIdkTIF$X)T1_mf-TErGIZTDn*s00A8uL}17 literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/29d64452f36fbdaf/dae8a428c24551c7 b/.hypothesis/examples/29d64452f36fbdaf/dae8a428c24551c7 new file mode 100644 index 0000000000000000000000000000000000000000..f682e331c46187ddc881bab12111b2e5aa2be9be GIT binary patch literal 33 ecmcEDIdi{*n1h{E0|OK^En*9qwtKQYR005{f(k_d literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/29d64452f36fbdaf/eb52399909c76bb8 b/.hypothesis/examples/29d64452f36fbdaf/eb52399909c76bb8 new file mode 100644 index 0000000000000000000000000000000000000000..2122e286bdc6fbfc5f61d0a7e1b430611d2fc9b2 GIT binary patch literal 33 ecmZ=T^7Ysu)?g>qzyJkJi`YV@?Vjual>h*YkqILJ literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/0c34bf18bcc77dff b/.hypothesis/examples/3a76e75eadfd834a/0c34bf18bcc77dff new file mode 100644 index 0000000000000000000000000000000000000000..a08c8cdeef71ffe6c821428fb66e9e90c1a32475 GIT binary patch literal 33 YcmcEDx!(Z@IM^7F0Q1xZX7*4C0CFJ)^8f$< literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/10da0065875f760f b/.hypothesis/examples/3a76e75eadfd834a/10da0065875f760f new file mode 100644 index 0000000000000000000000000000000000000000..dedbed425a07b1948e9f5643a152f93d597cf878 GIT binary patch literal 33 YcmZ=Tka7S54mJiPz&v$8{#z3F(bH;%+s009$s0j%G literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/71b60761307aa33f b/.hypothesis/examples/3a76e75eadfd834a/71b60761307aa33f new file mode 100644 index 0000000000000000000000000000000000000000..058019d69feda91065ee4f8a1d193690cb700a48 GIT binary patch literal 33 XcmcEDITHl_voRn6=BW$J?4c3>voH%? literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/8e7029315174e1ec b/.hypothesis/examples/3a76e75eadfd834a/8e7029315174e1ec new file mode 100644 index 0000000000000000000000000000000000000000..4980b5e0c12ab05b7cd4645e664202e4d98e220e GIT binary patch literal 33 XcmcEDITHkCu`wV4=BW$J?4c3>sEG=b literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/b66f89ef26caa2be b/.hypothesis/examples/3a76e75eadfd834a/b66f89ef26caa2be new file mode 100644 index 0000000000000000000000000000000000000000..67b4426305de89a093f71a6896f9ba13c45cd807 GIT binary patch literal 33 YcmcEDITHx>bFeWW0p_U-%h)~00z+j literal 0 HcmV?d00001 diff --git a/ciw/simulation.py b/ciw/simulation.py index eb076d71..cb60f81d 100644 --- a/ciw/simulation.py +++ b/ciw/simulation.py @@ -65,7 +65,6 @@ def __init__(self, *args, **kwargs): for i in xrange(self.parameters['Number_of_nodes'])] else: self.class_change_matrix = 'NA' - self.max_simulation_time = self.parameters['Simulation_time'] self.inter_arrival_times = self.find_times_dict(self.lmbda) self.service_times = self.find_times_dict(self.mu) self.transitive_nodes = [NodeType(i + 1, self) @@ -107,7 +106,6 @@ def build_parameters(self, params): 'Queue_capacities': ['Inf' for _ in xrange(len( params['Number_of_servers']))], 'Detect_deadlock': False, - 'Simulation_time': None, 'Exact': False } diff --git a/ciw/tests/test_simulation.py b/ciw/tests/test_simulation.py index faaf51b3..304549d2 100644 --- a/ciw/tests/test_simulation.py +++ b/ciw/tests/test_simulation.py @@ -73,7 +73,6 @@ def test_init_method_from_dict(self): 'Node 3', 'Node 4', 'Exit Node']) - self.assertEqual(Q.max_simulation_time, 150) self.assertEqual(Q.class_change_matrix, 'NA') self.assertEqual(Q.schedules, [False, False, False, False]) @@ -129,7 +128,6 @@ def test_init_method_from_kws(self): [0.1, 0.3, 0.2, 0.2], [0.0, 0.0, 0.0, 0.3]]} Detect_deadlock = False - Simulation_time = 150 Number_of_classes = 3 Number_of_nodes = 4 Class_change_matrices = {'Node 0': [[0.7, 0.3, 0.0], @@ -149,7 +147,6 @@ def test_init_method_from_kws(self): Queue_capacities = [20, 'Inf', 30, 'Inf'] Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, - Simulation_time = Simulation_time, Queue_capacities = Queue_capacities, Service_distributions = Service_distributions, Number_of_servers = Number_of_servers, @@ -201,13 +198,11 @@ def test_init_method_from_kws(self): 'Node 3', 'Node 4', 'Exit Node']) - self.assertEqual(Q.max_simulation_time, 150) self.assertEqual(Q.class_change_matrix, 'NA') self.assertEqual(Q.schedules, [False, False, False, False]) self.assertEqual(Q.queue_capacities, [20, 'Inf', 30, 'Inf']) Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, - Simulation_time = Simulation_time, Service_distributions = Service_distributions, Number_of_servers = Number_of_servers, Transition_matrices = Transition_matrices) @@ -255,13 +250,11 @@ def test_init_method_from_kws(self): 'Node 3', 'Node 4', 'Exit Node']) - self.assertEqual(Q.max_simulation_time, 150) self.assertEqual(Q.class_change_matrix, 'NA') self.assertEqual(Q.schedules, [False, False, False, False]) self.assertEqual(Q.queue_capacities, ['Inf', 'Inf', 'Inf', 'Inf']) Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, - Simulation_time = Simulation_time, Queue_capacities = Queue_capacities, Service_distributions = Service_distributions, Number_of_servers = Number_of_servers, @@ -284,7 +277,6 @@ def test_init_method_from_kws(self): [0.0, 0.0, 1.0]]]) Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, - Simulation_time = Simulation_time, Queue_capacities = Queue_capacities, Service_distributions = Service_distributions, Number_of_servers = Number_of_servers2, @@ -312,7 +304,6 @@ def test_init_method_from_kws(self): ['Exponential', 1.0]]}, Number_of_nodes = 4, Detect_deadlock = False, - Simulation_time = 150, Number_of_servers = [9, 10, 8, 8], Queue_capacities = [20, 'Inf', 30, 'Inf'], Number_of_classes = 3, @@ -354,7 +345,6 @@ def test_init_method_from_kws(self): ['Exponential', 4.0], ['Exponential', 1.0]]}, 'Number_of_nodes': 4, - 'Simulation_time': 150, 'Detect_deadlock': False, 'Exact': False, 'Name': 'Simulation', @@ -389,18 +379,15 @@ def test_init_method_from_kws(self): @given(arrival_rate = floats(min_value = 0.1, max_value = 100), service_rate = floats(min_value = 0.1, max_value = 100), number_of_servers = integers(min_value = 1, max_value = 30), - Simulation_time = floats(min_value = 1.0, max_value = 10.0), rm = random_module()) def test_simple_init_method(self, arrival_rate, service_rate, number_of_servers, - Simulation_time, rm): params = {'Arrival_distributions': [['Exponential', arrival_rate]], 'Service_distributions': [['Exponential', service_rate]], 'Number_of_servers': [number_of_servers], - 'Simulation_time': Simulation_time, 'Transition_matrices': [[0.0]]} Q = ciw.Simulation(params) @@ -414,7 +401,6 @@ def test_simple_init_method(self, 'Number_of_classes': 1, 'Name': 'Simulation', 'Queue_capacities': ['Inf'], - 'Simulation_time': Simulation_time, 'Detect_deadlock': False, 'Exact': False } @@ -425,25 +411,21 @@ def test_simple_init_method(self, self.assertEqual(Q.transition_matrix, [[[0.0]]]) self.assertEqual([str(obs) for obs in Q.nodes], ['Arrival Node', 'Node 1', 'Exit Node']) - self.assertEqual(Q.max_simulation_time, Simulation_time) self.assertEqual(Q.class_change_matrix, 'NA') self.assertEqual(Q.schedules, [False]) @given(arrival_rate = floats(min_value = 0.1, max_value = 100), service_rate = floats(min_value = 0.1, max_value = 100), number_of_servers = integers(min_value = 1, max_value = 30), - Simulation_time = floats(min_value = 1.0, max_value = 10.0), rm=random_module()) def test_build_mmc_parameters(self, arrival_rate, service_rate, number_of_servers, - Simulation_time, rm): params = {'Arrival_distributions': [['Exponential', arrival_rate]], 'Service_distributions': [['Exponential', service_rate]], 'Number_of_servers': [number_of_servers], - 'Simulation_time': Simulation_time, 'Transition_matrices': [[0.0]]} Q = ciw.Simulation(params) expected_dictionary = { @@ -454,7 +436,6 @@ def test_build_mmc_parameters(self, 'Number_of_nodes': 1, 'Number_of_classes': 1, 'Queue_capacities': ['Inf'], - 'Simulation_time': Simulation_time, 'Detect_deadlock': False, 'Exact': False, 'Name': 'Simulation' @@ -543,13 +524,11 @@ def test_mm1_from_file(self): @given(arrival_rate = floats(min_value = 0.1, max_value = 100), service_rate = floats(min_value = 0.1, max_value = 100), - Simulation_time = floats(min_value = 1.0, max_value = 10.0), rm=random_module()) - def test_mminf_node(self, arrival_rate, service_rate, Simulation_time, rm): + def test_mminf_node(self, arrival_rate, service_rate, rm): params = {'Arrival_distributions': [['Exponential', arrival_rate]], 'Service_distributions': [['Exponential', service_rate]], 'Number_of_servers': ['Inf'], - 'Simulation_time': Simulation_time, 'Transition_matrices': [[0.0]]} Q = ciw.Simulation(params) @@ -564,7 +543,6 @@ def test_raising_errors(self): 'Number_of_servers': [9], 'Number_of_classes': 1, 'Transition_matrices': {'Class 0': [[0.5]]}, - 'Simulation_time': 400, 'Number_of_nodes': 1, 'Queue_capacities': ['Inf'], 'Detect_deadlock': False} From 4b2ac920ae0f75be3940b61b34bbc1fc9a41aadd Mon Sep 17 00:00:00 2001 From: Vince Knight Date: Mon, 18 Apr 2016 14:23:13 +0100 Subject: [PATCH 06/20] Working on generator. --- ciw/node.py | 39 ++++++++++++------- .../parameters.yml | 11 +++--- ciw/tests/test_node.py | 23 +++++++++-- 3 files changed, 51 insertions(+), 22 deletions(-) diff --git a/ciw/node.py b/ciw/node.py index bc32d0d7..9e81fa0f 100644 --- a/ciw/node.py +++ b/ciw/node.py @@ -23,15 +23,18 @@ def __init__(self, id_, simulation): for cls in xrange(len(self.simulation.mu))] self.scheduled_servers = self.simulation.schedules[id_ - 1] if self.scheduled_servers: - self.schedule = self.simulation.parameters[ + raw_schedule = self.simulation.parameters[ self.simulation.c[id_ - 1]] - self.cyclelength = self.simulation.parameters[ - 'Cycle_length'] + self.cyclelength = raw_schedule[-1][0] + boundaries = [0] + [row[0] for row in raw_schedule[:-1]] + servers = [row[1] for row in raw_schedule] + self.schedule = [list(pair) for pair in zip(boundaries, servers)] self.c = self.schedule[0][1] - self.masterschedule = [self.increment_time(i*self.cyclelength, - obs) for i in xrange(int( - self.simulation.max_simulation_time//self.cyclelength - ) + 2) for obs in [t[0] for t in self.schedule]][1:] + + schedule = [row[0] for row in self.schedule] + self.date_generator = self.date_from_schedule_generator(schedule) + self.next_shift_change = self.date_generator.next() + else: self.c = self.simulation.c[id_ - 1] if self.simulation.queue_capacities[id_ - 1] == "Inf": @@ -48,7 +51,7 @@ def __init__(self, id_, simulation): self.individuals = [] self.id_number = id_ if self.scheduled_servers: - self.next_event_date = self.masterschedule[0] + self.next_event_date = self.next_shift_change else: self.next_event_date = "Inf" self.blocked_queue = [] @@ -183,7 +186,7 @@ def change_shift(self): """ shift = self.next_event_date%self.cyclelength - try: inx = self.schedule.index(shift) + try: indx = self.schedule.index(shift) except: tms = [obs[0] for obs in self.schedule] diffs = [abs(x-float(shift)) for x in tms] @@ -193,7 +196,7 @@ def change_shift(self): self.add_new_servers(indx) self.c = self.schedule[indx][1] - self.masterschedule.pop(0) + self.next_shift_change = self.date_generator.next() self.begin_service_if_possible_change_shift( self.next_event_date) @@ -202,7 +205,7 @@ def check_if_shiftchange(self): Check whether current time is a shift change. """ if self.scheduled_servers: - return self.next_event_date == self.masterschedule[0] + return self.next_event_date == self.next_shift_change return False def detatch_server(self, server, individual): @@ -357,7 +360,7 @@ def update_next_event_date(self, current_time): if not ind.is_blocked if ind.service_end_date >= current_time] + ["Inf"]) if self.scheduled_servers: - next_shift_change = self.masterschedule[0] + next_shift_change = self.next_shift_change self.next_event_date = min( next_end_service, next_shift_change) else: @@ -400,4 +403,14 @@ def write_individual_record(self, individual): individual.exit_date = False individual.queue_size_at_arrival = False individual.queue_size_at_departure = False - individual.destination = False \ No newline at end of file + individual.destination = False + + def date_from_schedule_generator(self, schedule): + """A generator that yields the next time according to a given schedule""" + schedule_len = len(schedule) + index = 0 + date = 0 + while True: + date = schedule[index % schedule_len] + (index) // schedule_len * schedule[-1] + index += 1 + yield date diff --git a/ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml b/ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml index c909b1dd..cfc4394f 100644 --- a/ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml +++ b/ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml @@ -12,7 +12,6 @@ Arrival_distributions: Detect_deadlock: False Number_of_classes: 2 Number_of_nodes: 2 -Cycle_length: 100 Number_of_servers: - 'schedule_1' - 3 @@ -43,11 +42,11 @@ Transition_matrices: - - 0.2 - 0.0 schedule_1: - - - 0 - - 1 - - 30 - - 2 - - - 60 - 1 + - - 60 + - 2 - - 90 - - 3 \ No newline at end of file + - 1 + - - 100 + - 3 diff --git a/ciw/tests/test_node.py b/ciw/tests/test_node.py index 73568446..b0a241cd 100644 --- a/ciw/tests/test_node.py +++ b/ciw/tests/test_node.py @@ -40,8 +40,9 @@ def test_init_method(self): self.assertEqual(N.scheduled_servers, True) self.assertEqual(N.cyclelength, 100) self.assertEqual(N.c, 1) - self.assertEqual(N.masterschedule, [30, 60, 90, 100, 130, - 160, 190, 200, 230, 260, 290, 300, 330, 360, 390]) + self.assertEqual(N.schedule, [[0, 1], [30, 2], [60, 1], [90, 3]]) + #self.assertEqual(N.masterschedule, [30, 60, 90, 100, 130, + #160, 190, 200, 230, 260, 290, 300, 330, 360, 390]) self.assertEqual(N.next_event_date, 30) def test_repr_method(self): @@ -374,7 +375,7 @@ def test_begin_service_if_possible_accept_method(self): 'ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml')) ind = ciw.Individual(1) self.assertEqual(Q.digraph.nodes(), - ['Server 5 at Node 2', + ['Server 5 at Node 2', 'Server 5 at Node 1', 'Server 3 at Node 2', 'Server 1 at Node 2', @@ -404,7 +405,11 @@ def test_kill_server_method(self): N.kill_server(s) self.assertEqual(N.servers, []) N.next_event_date = 30 + print "***************" + print N.next_shift_change N.have_event() + print N.next_shift_change + print "***************" self.assertEqual([str(obs) for obs in N.servers], ['Server 2 at Node 1', 'Server 3 at Node 1']) ind = ciw.Individual(666) @@ -529,3 +534,15 @@ def test_write_individual_record_method(self): self.assertEqual(round(ind.data_records[1][0].blocked, 5), 5.42106) self.assertEqual(ind.data_records[1][0].exit_date, 9) self.assertEqual(ind.data_records[1][0].customer_class, 0) + + def test_date_from_schedule_generator(self): + Q = ciw.Simulation(ciw.load_parameters( + 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + + sg = Q.nodes[1].date_from_schedule_generator([30, 60, 90, 100]) + self.assertEqual(sg.next(), 30) + self.assertEqual(sg.next(), 60) + self.assertEqual(sg.next(), 90) + self.assertEqual(sg.next(), 100) + self.assertEqual(sg.next(), 130) + self.assertEqual(sg.next(), 160) From e444507c8a42a5056d2f21aba2c1a4e3bb7c29dd Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Mon, 18 Apr 2016 15:21:54 +0100 Subject: [PATCH 07/20] made tests pass for server generator thing --- .../examples/29d64452f36fbdaf/0a4e40cf174cc33f | Bin 33 -> 0 bytes .../examples/29d64452f36fbdaf/2a460755cd3552ec | Bin 33 -> 0 bytes .../examples/29d64452f36fbdaf/310b6fe2a7d2e397 | Bin 33 -> 0 bytes .../examples/29d64452f36fbdaf/56d2b74af375f9c5 | Bin 33 -> 0 bytes .../examples/29d64452f36fbdaf/800209280d8e6594 | Bin 33 -> 0 bytes .../examples/29d64452f36fbdaf/84e4c3ba021aa616 | Bin 33 -> 0 bytes .../examples/29d64452f36fbdaf/94eb3cb9deacb94c | Bin 33 -> 0 bytes .../examples/29d64452f36fbdaf/a02d9438b36b1807 | Bin 33 -> 0 bytes .../examples/29d64452f36fbdaf/ca44bc385400f812 | Bin 33 -> 0 bytes .../examples/29d64452f36fbdaf/dae8a428c24551c7 | Bin 33 -> 0 bytes .../examples/29d64452f36fbdaf/eb52399909c76bb8 | Bin 33 -> 0 bytes .../examples/3a76e75eadfd834a/0c34bf18bcc77dff | Bin 33 -> 0 bytes .../examples/3a76e75eadfd834a/10da0065875f760f | Bin 33 -> 0 bytes .../examples/3a76e75eadfd834a/16724dec504c946a | Bin 33 -> 0 bytes .../examples/3a76e75eadfd834a/196e9ceb92a5d0d4 | Bin 33 -> 0 bytes .../examples/3a76e75eadfd834a/3627143134e9468d | Bin 33 -> 0 bytes .../examples/3a76e75eadfd834a/367696b95d1f505f | Bin 33 -> 0 bytes .../examples/3a76e75eadfd834a/475b08c9b98e8c5f | Bin 33 -> 0 bytes .../examples/3a76e75eadfd834a/4b1b22fcd376699a | Bin 33 -> 0 bytes .../examples/3a76e75eadfd834a/66cfbc7b8ff84a3b | Bin 33 -> 0 bytes .../examples/3a76e75eadfd834a/71b60761307aa33f | Bin 33 -> 0 bytes .../examples/3a76e75eadfd834a/8e7029315174e1ec | Bin 33 -> 0 bytes .../examples/3a76e75eadfd834a/b66f89ef26caa2be | Bin 33 -> 0 bytes .../examples/3a76e75eadfd834a/e322d867ec35d11a | Bin 33 -> 0 bytes .../examples/a40d01c034da88b1/274f542c0a374f79 | Bin 40 -> 0 bytes .../examples/a40d01c034da88b1/544e6ef018ad0543 | Bin 0 -> 88 bytes ciw/node.py | 12 ++++++------ ciw/tests/test_node.py | 4 ---- ciw/tests/test_simulation.py | 15 ++++++--------- 29 files changed, 12 insertions(+), 19 deletions(-) delete mode 100644 .hypothesis/examples/29d64452f36fbdaf/0a4e40cf174cc33f delete mode 100644 .hypothesis/examples/29d64452f36fbdaf/2a460755cd3552ec delete mode 100644 .hypothesis/examples/29d64452f36fbdaf/310b6fe2a7d2e397 delete mode 100644 .hypothesis/examples/29d64452f36fbdaf/56d2b74af375f9c5 delete mode 100644 .hypothesis/examples/29d64452f36fbdaf/800209280d8e6594 delete mode 100644 .hypothesis/examples/29d64452f36fbdaf/84e4c3ba021aa616 delete mode 100644 .hypothesis/examples/29d64452f36fbdaf/94eb3cb9deacb94c delete mode 100644 .hypothesis/examples/29d64452f36fbdaf/a02d9438b36b1807 delete mode 100644 .hypothesis/examples/29d64452f36fbdaf/ca44bc385400f812 delete mode 100644 .hypothesis/examples/29d64452f36fbdaf/dae8a428c24551c7 delete mode 100644 .hypothesis/examples/29d64452f36fbdaf/eb52399909c76bb8 delete mode 100644 .hypothesis/examples/3a76e75eadfd834a/0c34bf18bcc77dff delete mode 100644 .hypothesis/examples/3a76e75eadfd834a/10da0065875f760f delete mode 100644 .hypothesis/examples/3a76e75eadfd834a/16724dec504c946a delete mode 100644 .hypothesis/examples/3a76e75eadfd834a/196e9ceb92a5d0d4 delete mode 100644 .hypothesis/examples/3a76e75eadfd834a/3627143134e9468d delete mode 100644 .hypothesis/examples/3a76e75eadfd834a/367696b95d1f505f delete mode 100644 .hypothesis/examples/3a76e75eadfd834a/475b08c9b98e8c5f delete mode 100644 .hypothesis/examples/3a76e75eadfd834a/4b1b22fcd376699a delete mode 100644 .hypothesis/examples/3a76e75eadfd834a/66cfbc7b8ff84a3b delete mode 100644 .hypothesis/examples/3a76e75eadfd834a/71b60761307aa33f delete mode 100644 .hypothesis/examples/3a76e75eadfd834a/8e7029315174e1ec delete mode 100644 .hypothesis/examples/3a76e75eadfd834a/b66f89ef26caa2be delete mode 100644 .hypothesis/examples/3a76e75eadfd834a/e322d867ec35d11a delete mode 100644 .hypothesis/examples/a40d01c034da88b1/274f542c0a374f79 create mode 100644 .hypothesis/examples/a40d01c034da88b1/544e6ef018ad0543 diff --git a/.hypothesis/examples/29d64452f36fbdaf/0a4e40cf174cc33f b/.hypothesis/examples/29d64452f36fbdaf/0a4e40cf174cc33f deleted file mode 100644 index 09acad8bcfb8646292f245eb7954bd16f77d4397..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33 ecmcEDIdkUB{SJ0g4Gd7ww1_Qa+V08rPzeCQKnwi< diff --git a/.hypothesis/examples/29d64452f36fbdaf/2a460755cd3552ec b/.hypothesis/examples/29d64452f36fbdaf/2a460755cd3552ec deleted file mode 100644 index d49a221821ce7368bb9373cc7e2ccb875e7e9d1b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33 ecmcED@8IAd=3pn)zyJkJi`YV@?VfB8l>h*UG6qzyJkJi`YV@?Vjual>h*YkqILJ diff --git a/.hypothesis/examples/3a76e75eadfd834a/0c34bf18bcc77dff b/.hypothesis/examples/3a76e75eadfd834a/0c34bf18bcc77dff deleted file mode 100644 index a08c8cdeef71ffe6c821428fb66e9e90c1a32475..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33 YcmcEDx!(Z@IM^7F0Q1xZX7*4C0CFJ)^8f$< diff --git a/.hypothesis/examples/3a76e75eadfd834a/10da0065875f760f b/.hypothesis/examples/3a76e75eadfd834a/10da0065875f760f deleted file mode 100644 index dedbed425a07b1948e9f5643a152f93d597cf878..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33 YcmZ=Tka7S54mJiPz&v$8{#z3F(bH;%+s009$s0j%G diff --git a/.hypothesis/examples/3a76e75eadfd834a/71b60761307aa33f b/.hypothesis/examples/3a76e75eadfd834a/71b60761307aa33f deleted file mode 100644 index 058019d69feda91065ee4f8a1d193690cb700a48..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33 XcmcEDITHl_voRn6=BW$J?4c3>voH%? diff --git a/.hypothesis/examples/3a76e75eadfd834a/8e7029315174e1ec b/.hypothesis/examples/3a76e75eadfd834a/8e7029315174e1ec deleted file mode 100644 index 4980b5e0c12ab05b7cd4645e664202e4d98e220e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33 XcmcEDITHkCu`wV4=BW$J?4c3>sEG=b diff --git a/.hypothesis/examples/3a76e75eadfd834a/b66f89ef26caa2be b/.hypothesis/examples/3a76e75eadfd834a/b66f89ef26caa2be deleted file mode 100644 index 67b4426305de89a093f71a6896f9ba13c45cd807..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33 YcmcEDITHx>bFeWW0p_U-%h)~00z+j diff --git a/.hypothesis/examples/a40d01c034da88b1/274f542c0a374f79 b/.hypothesis/examples/a40d01c034da88b1/274f542c0a374f79 deleted file mode 100644 index 3fe79fb9c0f6ef723de462f57faf3ac7395940a5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40 WcmcEjzyJpJJ7%l!o&f?A_`6b diff --git a/.hypothesis/examples/a40d01c034da88b1/544e6ef018ad0543 b/.hypothesis/examples/a40d01c034da88b1/544e6ef018ad0543 new file mode 100644 index 0000000000000000000000000000000000000000..1a5a37b5c38a4851f3928c550622b8728717585b GIT binary patch literal 88 zcmZ>;I>t~^ Date: Mon, 18 Apr 2016 15:34:28 +0100 Subject: [PATCH 08/20] Adjusting hypothesis run time. --- .../examples/a40d01c034da88b1/544e6ef018ad0543 | Bin 88 -> 0 bytes ciw/tests/test_simulation.py | 9 ++++----- 2 files changed, 4 insertions(+), 5 deletions(-) delete mode 100644 .hypothesis/examples/a40d01c034da88b1/544e6ef018ad0543 diff --git a/.hypothesis/examples/a40d01c034da88b1/544e6ef018ad0543 b/.hypothesis/examples/a40d01c034da88b1/544e6ef018ad0543 deleted file mode 100644 index 1a5a37b5c38a4851f3928c550622b8728717585b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 88 zcmZ>;I>t~^ Date: Mon, 18 Apr 2016 16:03:10 +0100 Subject: [PATCH 09/20] tests for servicecentre object, tests fail --- .../29a0888f2630c3d7/2d5103d9aa08908b | Bin 0 -> 32 bytes .../29a0888f2630c3d7/3bfd3000f4d09ff0 | Bin 0 -> 32 bytes .../29a0888f2630c3d7/aeed295ab0fa36c1 | Bin 0 -> 32 bytes .../29a0888f2630c3d7/de8a847bff8c343d | Bin 0 -> 32 bytes .../a40d01c034da88b1/02848ce3c6dfca85 | Bin 0 -> 32 bytes .../a40d01c034da88b1/0adbbc0e978d87be | Bin 0 -> 32 bytes .../a40d01c034da88b1/1c20758af7e9f9a5 | Bin 0 -> 32 bytes .../a40d01c034da88b1/589cd42f92297ac4 | Bin 0 -> 32 bytes .../a40d01c034da88b1/7cc4aa8f917cbbfc | Bin 0 -> 32 bytes .../a40d01c034da88b1/842726a1f97b58d8 | Bin 0 -> 32 bytes .../a40d01c034da88b1/94b6e6116f53a455 | Bin 0 -> 32 bytes .../a40d01c034da88b1/ae1636a12488347b | Bin 0 -> 32 bytes .../a40d01c034da88b1/c5dccddeaad3275a | Bin 0 -> 32 bytes .../a40d01c034da88b1/ecb1ac629f8d49ff | Bin 0 -> 32 bytes ciw/network.py | 0 ciw/tests/test_network.py | 39 ++++++++++++++++++ 16 files changed, 39 insertions(+) create mode 100644 .hypothesis/examples/29a0888f2630c3d7/2d5103d9aa08908b create mode 100644 .hypothesis/examples/29a0888f2630c3d7/3bfd3000f4d09ff0 create mode 100644 .hypothesis/examples/29a0888f2630c3d7/aeed295ab0fa36c1 create mode 100644 .hypothesis/examples/29a0888f2630c3d7/de8a847bff8c343d create mode 100644 .hypothesis/examples/a40d01c034da88b1/02848ce3c6dfca85 create mode 100644 .hypothesis/examples/a40d01c034da88b1/0adbbc0e978d87be create mode 100644 .hypothesis/examples/a40d01c034da88b1/1c20758af7e9f9a5 create mode 100644 .hypothesis/examples/a40d01c034da88b1/589cd42f92297ac4 create mode 100644 .hypothesis/examples/a40d01c034da88b1/7cc4aa8f917cbbfc create mode 100644 .hypothesis/examples/a40d01c034da88b1/842726a1f97b58d8 create mode 100644 .hypothesis/examples/a40d01c034da88b1/94b6e6116f53a455 create mode 100644 .hypothesis/examples/a40d01c034da88b1/ae1636a12488347b create mode 100644 .hypothesis/examples/a40d01c034da88b1/c5dccddeaad3275a create mode 100644 .hypothesis/examples/a40d01c034da88b1/ecb1ac629f8d49ff create mode 100644 ciw/network.py create mode 100644 ciw/tests/test_network.py diff --git a/.hypothesis/examples/29a0888f2630c3d7/2d5103d9aa08908b b/.hypothesis/examples/29a0888f2630c3d7/2d5103d9aa08908b new file mode 100644 index 0000000000000000000000000000000000000000..715d6d5867772c29d7e33c6cfdf09fae3d882288 GIT binary patch literal 32 ScmZQzzy{3Df<+k>?gIb{lL7<) literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/29a0888f2630c3d7/3bfd3000f4d09ff0 b/.hypothesis/examples/29a0888f2630c3d7/3bfd3000f4d09ff0 new file mode 100644 index 0000000000000000000000000000000000000000..e3ccfb2081fec033835f717dba7887bbbc136bd0 GIT binary patch literal 32 OcmZQzzylZ+?gIb;LID8) literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/29a0888f2630c3d7/aeed295ab0fa36c1 b/.hypothesis/examples/29a0888f2630c3d7/aeed295ab0fa36c1 new file mode 100644 index 0000000000000000000000000000000000000000..c5acda467e98568ba68971bafab980a205210a70 GIT binary patch literal 32 XcmZQzfB^dsPzIPXI}4^5748E7CJO^I literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/29a0888f2630c3d7/de8a847bff8c343d b/.hypothesis/examples/29a0888f2630c3d7/de8a847bff8c343d new file mode 100644 index 0000000000000000000000000000000000000000..4e4e4935707a596987ec1cc32e3d0d587dbe4f04 GIT binary patch literal 32 KcmZQzzz+ZbAOHaX literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/02848ce3c6dfca85 b/.hypothesis/examples/a40d01c034da88b1/02848ce3c6dfca85 new file mode 100644 index 0000000000000000000000000000000000000000..216ffd40a9f628a20d80e7abfd85db14cd075f82 GIT binary patch literal 32 XcmcEDIdkUB{|>?p3@Cup9x4t1m4yhj literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/0adbbc0e978d87be b/.hypothesis/examples/a40d01c034da88b1/0adbbc0e978d87be new file mode 100644 index 0000000000000000000000000000000000000000..a208c5678c353f48fb479392c917a54e5f22a0a0 GIT binary patch literal 32 VcmcEDITHx}3pX&J08V?TH~^k?31$EQ literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/1c20758af7e9f9a5 b/.hypothesis/examples/a40d01c034da88b1/1c20758af7e9f9a5 new file mode 100644 index 0000000000000000000000000000000000000000..a8bebd42e03cb0314f9b9d5c1e40bdd2e78ac580 GIT binary patch literal 32 VcmcED&*T6E!VL^4fYTl-4ggcx1h4=A literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/589cd42f92297ac4 b/.hypothesis/examples/a40d01c034da88b1/589cd42f92297ac4 new file mode 100644 index 0000000000000000000000000000000000000000..5c4ea557eb47233f37a7948de14e168ca79e6a8c GIT binary patch literal 32 VcmcEDITHx>3pX&J08V?TH~^P*2<89) literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/7cc4aa8f917cbbfc b/.hypothesis/examples/a40d01c034da88b1/7cc4aa8f917cbbfc new file mode 100644 index 0000000000000000000000000000000000000000..12292133bd44cf24d0328bef75cb7cff63e14ce9 GIT binary patch literal 32 VcmcEj&*T6E!VL^4fYTl-4gg(Q1uy^r literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/842726a1f97b58d8 b/.hypothesis/examples/a40d01c034da88b1/842726a1f97b58d8 new file mode 100644 index 0000000000000000000000000000000000000000..e6b2e4126fb9e9b2f638b1ba8a0685f0468d9243 GIT binary patch literal 32 ScmcEDITHkCF`xl^s5k(WvI!pm literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/94b6e6116f53a455 b/.hypothesis/examples/a40d01c034da88b1/94b6e6116f53a455 new file mode 100644 index 0000000000000000000000000000000000000000..591a2fae797e0aef0af75677cb00ac9b11021cdb GIT binary patch literal 32 UcmcEDITHl_H!z?8PJ5_00INj`asU7T literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/ae1636a12488347b b/.hypothesis/examples/a40d01c034da88b1/ae1636a12488347b new file mode 100644 index 0000000000000000000000000000000000000000..347ea0aaa7c379d48386a7e663dbe892cd9970e7 GIT binary patch literal 32 VcmcED`QHHugc}%80H-}v8~}ES2A%)_ literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/c5dccddeaad3275a b/.hypothesis/examples/a40d01c034da88b1/c5dccddeaad3275a new file mode 100644 index 0000000000000000000000000000000000000000..dab1845195ad6b74f237d62de575faf873a63b32 GIT binary patch literal 32 XcmcEDIdkTI2M6H>1{A<)4;2RhgX0H+ literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/ecb1ac629f8d49ff b/.hypothesis/examples/a40d01c034da88b1/ecb1ac629f8d49ff new file mode 100644 index 0000000000000000000000000000000000000000..1927d3fb299a35927aefff667a621ac5b129e6fb GIT binary patch literal 32 XcmcEDIdkUB{SLwn3@Cup9x4t1js*xb literal 0 HcmV?d00001 diff --git a/ciw/network.py b/ciw/network.py new file mode 100644 index 00000000..e69de29b diff --git a/ciw/tests/test_network.py b/ciw/tests/test_network.py new file mode 100644 index 00000000..91ca185e --- /dev/null +++ b/ciw/tests/test_network.py @@ -0,0 +1,39 @@ +import unittest +import ciw +from hypothesis import given +from hypothesis.strategies import floats, integers, lists, random_module + + +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 + 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) + + @given(number_of_servers=integers(min_value=1), + queueing_capacity=integers(min_value=0), + 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 + 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) \ No newline at end of file From aef8fe705c5c672224fba4e2f6552d216a8f547d Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Mon, 18 Apr 2016 16:07:36 +0100 Subject: [PATCH 10/20] ServiceCentre written, tests pass --- ciw/__init__.py | 1 + ciw/network.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/ciw/__init__.py b/ciw/__init__.py index 3891ca98..416f5d02 100644 --- a/ciw/__init__.py +++ b/ciw/__init__.py @@ -8,5 +8,6 @@ from state_tracker import * from exactnode import * from import_params import load_parameters +from network import * __version__ = '0.0.6' \ No newline at end of file diff --git a/ciw/network.py b/ciw/network.py index e69de29b..4601c921 100644 --- a/ciw/network.py +++ b/ciw/network.py @@ -0,0 +1,16 @@ +class ServiceCentre: + """ + An information store for each service centre in the queueing network + """ + def __init__(self, + number_of_servers, + queueing_capacity, + class_change_matrix=None, + schedule=None): + """ + Initialises the ServiceCentre object + """ + 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 From 06091b7565c27bdcc896af23ec03465fad1d5955 Mon Sep 17 00:00:00 2001 From: Vince Knight Date: Mon, 18 Apr 2016 16:21:04 +0100 Subject: [PATCH 11/20] 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) From 5da1853662c1134e25dca428b64357d951b45c51 Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Tue, 19 Apr 2016 12:24:22 +0100 Subject: [PATCH 12/20] Network_From_Dictionary written, needs rename --- ciw/__init__.py | 2 +- ciw/import_params.py | 56 +++++++++++++++++++- ciw/network.py | 13 +++++ ciw/tests/test_network.py | 107 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 176 insertions(+), 2 deletions(-) diff --git a/ciw/__init__.py b/ciw/__init__.py index 416f5d02..8c489ab7 100644 --- a/ciw/__init__.py +++ b/ciw/__init__.py @@ -7,7 +7,7 @@ from node import Node from state_tracker import * from exactnode import * -from import_params import load_parameters +from import_params import * from network import * __version__ = '0.0.6' \ No newline at end of file diff --git a/ciw/import_params.py b/ciw/import_params.py index d75ad962..6252e894 100644 --- a/ciw/import_params.py +++ b/ciw/import_params.py @@ -1,5 +1,6 @@ import os import yaml +from network import * def load_parameters(directory_name): @@ -12,4 +13,57 @@ def load_parameters(directory_name): parameter_file = open(parameter_file_name, 'r') parameters = yaml.load(parameter_file) parameter_file.close() - return parameters \ No newline at end of file + return parameters + +def Network_From_Dictionary(params): + """ + Creates a Network object from a parameters dictionary + """ + if isinstance(params['Arrival_distributions'], dict): + arrivals = [params['Arrival_distributions']['Class ' + str(cls)] + for cls in xrange(len(params['Arrival_distributions']))] + if isinstance(params['Arrival_distributions'], list): + arrivals = [params['Arrival_distributions']] + + if isinstance(params['Service_distributions'], dict): + services = [params['Service_distributions']['Class ' + str(cls)] + for cls in xrange(len(params['Service_distributions']))] + if isinstance(params['Service_distributions'], list): + services = [params['Service_distributions']] + + if isinstance(params['Transition_matrices'], dict): + transitions = [params['Transition_matrices']['Class ' + str(cls)] + for cls in xrange(len(params['Transition_matrices']))] + if isinstance(params['Transition_matrices'], list): + transitions = [params['Transition_matrices']] + + number_of_classes = params.get('Number_of_classes', len(arrivals)) + number_of_nodes = params.get('Number_of_nodes', len(arrivals[0])) + queueing_capacities = params.get('Queue_capacities', + ['Inf' for i in xrange(number_of_nodes)]) + class_change_matrices = params.get('Class_change_matrices', + {'Node ' + str(nd + 1): None for nd in xrange(number_of_nodes)}) + number_of_servers = [] + schedules = [] + for c in params['Number_of_servers']: + if isinstance(c, str): + number_of_servers.append('schedule') + schedules.append(params[c]) + else: + + number_of_servers.append(c) + schedules.append(None) + + nodes = [] + for nd in xrange(number_of_nodes): + nodes.append(ServiceCentre(number_of_servers[nd], + queueing_capacities[nd], + class_change_matrices['Node ' + str(nd + 1)], + schedules[nd])) + classes = [] + for cls in xrange(number_of_classes): + classes.append(CustomerClass(arrivals[cls], + services[cls], + transitions[cls])) + N = Network(nodes, classes) + return N \ No newline at end of file diff --git a/ciw/network.py b/ciw/network.py index a3cec2a5..781845c1 100644 --- a/ciw/network.py +++ b/ciw/network.py @@ -30,3 +30,16 @@ def __init__(self, self.arrival_distributions = arrival_distributions self.service_distributions = service_distributions self.transition_matrix = transition_matrix + +class Network: + """ + An information store the queueing network + """ + def __init__(self, service_centres, customer_classes): + """ + Initialises the Network object + """ + self.service_centres = service_centres + self.customer_classes = customer_classes + self.number_of_service_centres = len(service_centres) + self.number_of_customer_classes = len(customer_classes) \ No newline at end of file diff --git a/ciw/tests/test_network.py b/ciw/tests/test_network.py index 46de39b9..4d6c2038 100644 --- a/ciw/tests/test_network.py +++ b/ciw/tests/test_network.py @@ -56,3 +56,110 @@ def test_init_method(self): self.assertEqual(CC.arrival_distributions, arrival_distributions) self.assertEqual(CC.service_distributions, service_distributions) self.assertEqual(CC.transition_matrix, transition_matrix) + + + +class TestNetwork(unittest.TestCase): + + def test_init_method(self): + service_centres = [] + for i in xrange(4): + number_of_servers = 2 + queueing_capacity = 'Inf' + class_change_matrix = [[0.2, 0.8], + [1.0, 0.0]] + schedule = None + service_centres.append(ciw.ServiceCentre(number_of_servers, + queueing_capacity, + class_change_matrix, + schedule)) + customer_classes = [] + for i in xrange(2): + 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]] + customer_classes.append(ciw.CustomerClass(arrival_distributions, + service_distributions, + transition_matrix)) + + 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_service_centres, 4) + self.assertEqual(N.number_of_customer_classes, 2) + + + def test_network_from_dictionary(self): + params = {'Arrival_distributions': {'Class 0': [['Exponential', 3.0]]}, + 'Service_distributions': {'Class 0': [['Exponential', 7.0]]}, + 'Number_of_servers': [9], + 'Number_of_classes': 1, + 'Transition_matrices': {'Class 0': [[0.5]]}, + 'Number_of_nodes': 1, + 'Queue_capacities': ['Inf']} + N = ciw.Network_From_Dictionary(params) + + self.assertEqual(N.number_of_service_centres, 1) + self.assertEqual(N.number_of_customer_classes, 1) + self.assertEqual(N.service_centres[0].queueing_capacity, 'Inf') + self.assertEqual(N.service_centres[0].number_of_servers, 9) + self.assertEqual(N.service_centres[0].class_change_matrix, None) + self.assertEqual(N.service_centres[0].schedule, None) + self.assertEqual(N.customer_classes[0].arrival_distributions, [['Exponential', 3.0]]) + self.assertEqual(N.customer_classes[0].service_distributions, [['Exponential', 7.0]]) + self.assertEqual(N.customer_classes[0].transition_matrix, [[0.5]]) + + + params = {'Arrival_distributions': [['Exponential', 3.0], ['Uniform', 0.2, 0.6]], + 'Service_distributions': [['Exponential', 7.0], ['Deterministic', 0.7]], + 'Number_of_servers': ['my_amazing_schedule', 3], + 'Transition_matrices': [[0.5, 0.2], [0.0, 0.0]], + 'Queue_capacities': [10, 'Inf'], + 'my_amazing_schedule': [[20, 1], [50, 4]]} + N = ciw.Network_From_Dictionary(params) + + self.assertEqual(N.number_of_service_centres, 2) + self.assertEqual(N.number_of_customer_classes, 1) + self.assertEqual(N.service_centres[0].queueing_capacity, 10) + self.assertEqual(N.service_centres[0].number_of_servers, 'schedule') + self.assertEqual(N.service_centres[0].class_change_matrix, None) + self.assertEqual(N.service_centres[0].schedule, [[20, 1], [50, 4]]) + self.assertEqual(N.service_centres[1].queueing_capacity, 'Inf') + self.assertEqual(N.service_centres[1].number_of_servers, 3) + self.assertEqual(N.service_centres[1].class_change_matrix, None) + self.assertEqual(N.service_centres[1].schedule, None) + self.assertEqual(N.customer_classes[0].arrival_distributions, [['Exponential', 3.0], ['Uniform', 0.2, 0.6]]) + self.assertEqual(N.customer_classes[0].service_distributions, [['Exponential', 7.0], ['Deterministic', 0.7]]) + self.assertEqual(N.customer_classes[0].transition_matrix, [[0.5, 0.2], [0.0, 0.0]]) + + + params = {'Arrival_distributions': {'Class 0': [['Exponential', 3.0]], + 'Class 1': [['Exponential', 4.0]]}, + 'Service_distributions': {'Class 0': [['Exponential', 7.0]], + 'Class 1': [['Uniform', 0.4, 1.2]]}, + 'Number_of_servers': [9], + 'Transition_matrices': {'Class 0': [[0.5]], + 'Class 1': [[0.0]]}, + 'Number_of_nodes': 1, + 'Queue_capacities': ['Inf'], + 'Class_change_matrices': {'Node 1': [[0.0, 1.0], [0.2, 0.8]]}} + N = ciw.Network_From_Dictionary(params) + + self.assertEqual(N.number_of_service_centres, 1) + self.assertEqual(N.number_of_customer_classes, 2) + self.assertEqual(N.service_centres[0].queueing_capacity, 'Inf') + self.assertEqual(N.service_centres[0].number_of_servers, 9) + self.assertEqual(N.service_centres[0].class_change_matrix, [[0.0, 1.0], [0.2, 0.8]]) + self.assertEqual(N.service_centres[0].schedule, None) + self.assertEqual(N.customer_classes[0].arrival_distributions, [['Exponential', 3.0]]) + self.assertEqual(N.customer_classes[0].service_distributions, [['Exponential', 7.0]]) + self.assertEqual(N.customer_classes[0].transition_matrix, [[0.5]]) + self.assertEqual(N.customer_classes[1].arrival_distributions, [['Exponential', 4.0]]) + self.assertEqual(N.customer_classes[1].service_distributions, [['Uniform', 0.4, 1.2]]) + self.assertEqual(N.customer_classes[1].transition_matrix, [[0.0]]) + From 40f8aa8bf9853677311b0d4c6da46a7209b84ff3 Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Tue, 19 Apr 2016 14:03:25 +0100 Subject: [PATCH 13/20] tidyup --- ciw/import_params.py | 38 ++++++------- ciw/tests/test_network.py | 109 ++++++++++++++++++++++---------------- 2 files changed, 83 insertions(+), 64 deletions(-) diff --git a/ciw/import_params.py b/ciw/import_params.py index 6252e894..ddd933b3 100644 --- a/ciw/import_params.py +++ b/ciw/import_params.py @@ -24,46 +24,46 @@ def Network_From_Dictionary(params): for cls in xrange(len(params['Arrival_distributions']))] if isinstance(params['Arrival_distributions'], list): arrivals = [params['Arrival_distributions']] - if isinstance(params['Service_distributions'], dict): services = [params['Service_distributions']['Class ' + str(cls)] for cls in xrange(len(params['Service_distributions']))] if isinstance(params['Service_distributions'], list): services = [params['Service_distributions']] - if isinstance(params['Transition_matrices'], dict): transitions = [params['Transition_matrices']['Class ' + str(cls)] for cls in xrange(len(params['Transition_matrices']))] if isinstance(params['Transition_matrices'], list): transitions = [params['Transition_matrices']] - number_of_classes = params.get('Number_of_classes', len(arrivals)) number_of_nodes = params.get('Number_of_nodes', len(arrivals[0])) queueing_capacities = params.get('Queue_capacities', ['Inf' for i in xrange(number_of_nodes)]) class_change_matrices = params.get('Class_change_matrices', {'Node ' + str(nd + 1): None for nd in xrange(number_of_nodes)}) - number_of_servers = [] - schedules = [] + number_of_servers, schedules, nodes, classes = [], [], [], [] for c in params['Number_of_servers']: if isinstance(c, str): number_of_servers.append('schedule') schedules.append(params[c]) else: - number_of_servers.append(c) - schedules.append(None) - - nodes = [] + schedules.append(None) for nd in xrange(number_of_nodes): - nodes.append(ServiceCentre(number_of_servers[nd], - queueing_capacities[nd], - class_change_matrices['Node ' + str(nd + 1)], - schedules[nd])) - classes = [] + nodes.append(ServiceCentre( + number_of_servers[nd], + queueing_capacities[nd], + class_change_matrices['Node ' + str(nd + 1)], + schedules[nd])) for cls in xrange(number_of_classes): - classes.append(CustomerClass(arrivals[cls], - services[cls], - transitions[cls])) - N = Network(nodes, classes) - return N \ No newline at end of file + classes.append(CustomerClass( + arrivals[cls], + services[cls], + transitions[cls])) + return Network(nodes, classes) + +def Network_From_File(directory_name): + """ + Creates a Network object form a yaml file + """ + params = load_parameters(directory_name) + return Network_From_Dictionary(params) \ No newline at end of file diff --git a/ciw/tests/test_network.py b/ciw/tests/test_network.py index 4d6c2038..9ec15251 100644 --- a/ciw/tests/test_network.py +++ b/ciw/tests/test_network.py @@ -12,10 +12,7 @@ def test_init_method(self): 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) + 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) @@ -26,13 +23,12 @@ 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]] + 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) + 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) @@ -50,9 +46,7 @@ def test_init_method(self): ["Exponential", 5]] transition_matrix = [[.2, .6, .2], [0, 0, 0], [.5, 0, 0]] - CC = ciw.CustomerClass(arrival_distributions, - service_distributions, - transition_matrix) + 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) @@ -62,32 +56,23 @@ def test_init_method(self): class TestNetwork(unittest.TestCase): def test_init_method(self): - service_centres = [] - for i in xrange(4): - number_of_servers = 2 - queueing_capacity = 'Inf' - class_change_matrix = [[0.2, 0.8], - [1.0, 0.0]] - schedule = None - service_centres.append(ciw.ServiceCentre(number_of_servers, - queueing_capacity, - class_change_matrix, - schedule)) - customer_classes = [] - for i in xrange(2): - 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]] - customer_classes.append(ciw.CustomerClass(arrival_distributions, - service_distributions, - transition_matrix)) - + 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]] + service_centres = [ciw.ServiceCentre(number_of_servers, queueing_capacity, class_change_matrix, schedule) for i in xrange(4)] + customer_classes = [ciw.CustomerClass(arrival_distributions, service_distributions, transition_matrix) for i in xrange(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_service_centres, 4) @@ -115,14 +100,17 @@ def test_network_from_dictionary(self): self.assertEqual(N.customer_classes[0].transition_matrix, [[0.5]]) - params = {'Arrival_distributions': [['Exponential', 3.0], ['Uniform', 0.2, 0.6]], - 'Service_distributions': [['Exponential', 7.0], ['Deterministic', 0.7]], + params = {'Arrival_distributions': [['Exponential', 3.0], + ['Uniform', 0.2, 0.6]], + 'Service_distributions': [['Exponential', 7.0], + ['Deterministic', 0.7]], 'Number_of_servers': ['my_amazing_schedule', 3], - 'Transition_matrices': [[0.5, 0.2], [0.0, 0.0]], + 'Transition_matrices': [[0.5, 0.2], + [0.0, 0.0]], 'Queue_capacities': [10, 'Inf'], - 'my_amazing_schedule': [[20, 1], [50, 4]]} + 'my_amazing_schedule': [[20, 1], + [50, 4]]} N = ciw.Network_From_Dictionary(params) - self.assertEqual(N.number_of_service_centres, 2) self.assertEqual(N.number_of_customer_classes, 1) self.assertEqual(N.service_centres[0].queueing_capacity, 10) @@ -147,9 +135,9 @@ def test_network_from_dictionary(self): 'Class 1': [[0.0]]}, 'Number_of_nodes': 1, 'Queue_capacities': ['Inf'], - 'Class_change_matrices': {'Node 1': [[0.0, 1.0], [0.2, 0.8]]}} + 'Class_change_matrices': {'Node 1': [[0.0, 1.0], + [0.2, 0.8]]}} N = ciw.Network_From_Dictionary(params) - self.assertEqual(N.number_of_service_centres, 1) self.assertEqual(N.number_of_customer_classes, 2) self.assertEqual(N.service_centres[0].queueing_capacity, 'Inf') @@ -163,3 +151,34 @@ def test_network_from_dictionary(self): self.assertEqual(N.customer_classes[1].service_distributions, [['Uniform', 0.4, 1.2]]) self.assertEqual(N.customer_classes[1].transition_matrix, [[0.0]]) + + def test_network_from_file(self): + N = ciw.Network_From_File( + 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + self.assertEqual(N.number_of_service_centres, 4) + self.assertEqual(N.number_of_customer_classes, 3) + self.assertEqual(N.service_centres[0].queueing_capacity, 20) + self.assertEqual(N.service_centres[1].queueing_capacity, 'Inf') + self.assertEqual(N.service_centres[2].queueing_capacity, 30) + self.assertEqual(N.service_centres[3].queueing_capacity, 'Inf') + self.assertEqual(N.service_centres[0].number_of_servers, 9) + self.assertEqual(N.service_centres[1].number_of_servers, 10) + self.assertEqual(N.service_centres[2].number_of_servers, 8) + self.assertEqual(N.service_centres[3].number_of_servers, 8) + self.assertEqual(N.service_centres[0].class_change_matrix, None) + self.assertEqual(N.service_centres[1].class_change_matrix, None) + self.assertEqual(N.service_centres[2].class_change_matrix, None) + self.assertEqual(N.service_centres[3].class_change_matrix, None) + self.assertEqual(N.service_centres[0].schedule, None) + self.assertEqual(N.service_centres[1].schedule, None) + self.assertEqual(N.service_centres[2].schedule, None) + self.assertEqual(N.service_centres[3].schedule, None) + self.assertEqual(N.customer_classes[0].arrival_distributions, [['Exponential', 3.0], ['Exponential', 7.0], ['Exponential', 4.0], ['Exponential', 1.0]]) + self.assertEqual(N.customer_classes[1].arrival_distributions, [['Exponential', 2.0], ['Exponential', 3.0], ['Exponential', 6.0], ['Exponential', 4.0]]) + self.assertEqual(N.customer_classes[2].arrival_distributions, [['Exponential', 2.0], ['Exponential', 1.0], ['Exponential', 2.0], ['Exponential', 0.5]]) + self.assertEqual(N.customer_classes[0].service_distributions, [['Exponential', 7.0], ['Exponential', 7.0], ['Gamma', 0.4, 0.6], ['Deterministic', 0.5]]) + self.assertEqual(N.customer_classes[1].service_distributions, [['Exponential', 7.0], ['Triangular', 0.1, 0.85, 0.8], ['Exponential', 8.0], ['Exponential', 5.0]]) + self.assertEqual(N.customer_classes[2].service_distributions, [['Deterministic', 0.3], ['Deterministic', 0.2], ['Exponential', 8.0], ['Exponential', 9.0]]) + self.assertEqual(N.customer_classes[0].transition_matrix, [[0.1, 0.2, 0.1, 0.4], [0.2, 0.2, 0.0, 0.1], [0.0, 0.8, 0.1, 0.1], [0.4, 0.1, 0.1, 0.0]]) + self.assertEqual(N.customer_classes[1].transition_matrix, [[0.6, 0.0, 0.0, 0.2], [0.1, 0.1, 0.2, 0.2], [0.9, 0.0, 0.0, 0.0], [0.2, 0.1, 0.1, 0.1]]) + self.assertEqual(N.customer_classes[2].transition_matrix, [[0.0, 0.0, 0.4, 0.3], [0.1, 0.1, 0.1, 0.1], [0.1, 0.3, 0.2, 0.2], [0.0, 0.0, 0.0, 0.3]]) \ No newline at end of file From 0cde40d1b4386e93623d9f31182132db5a29cc2e Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Tue, 19 Apr 2016 14:22:51 +0100 Subject: [PATCH 14/20] restructure test cases parameters --- ciw/tests/test_arrival_node.py | 14 +++--- ciw/tests/test_network.py | 2 +- ciw/tests/test_node.py | 48 +++++++++---------- ciw/tests/test_sampling.py | 6 +-- ciw/tests/test_server.py | 4 +- ciw/tests/test_simulation.py | 48 +++++++++---------- ciw/tests/test_state_tracker.py | 48 +++++++++---------- .../params.yml} | 0 .../params_change_class.yml} | 0 .../params_custom_dist.yml} | 0 .../params_deadlock.yml} | 0 .../params_mm1.yml} | 0 .../params_schedule.yml} | 0 .../sample_empirical_dist.csv | 0 14 files changed, 85 insertions(+), 85 deletions(-) rename ciw/tests/{datafortesting/logs_test_for_simulation/parameters.yml => testing_parameters/params.yml} (100%) rename ciw/tests/{datafortesting/logs_test_for_dynamic_classes/parameters.yml => testing_parameters/params_change_class.yml} (100%) rename ciw/tests/{datafortesting/logs_test_for_custom_dist/parameters.yml => testing_parameters/params_custom_dist.yml} (100%) rename ciw/tests/{datafortesting/logs_test_for_deadlock_sim/parameters.yml => testing_parameters/params_deadlock.yml} (100%) rename ciw/tests/{datafortesting/logs_test_for_mm1/parameters.yml => testing_parameters/params_mm1.yml} (100%) rename ciw/tests/{datafortesting/logs_test_for_server_schedule/parameters.yml => testing_parameters/params_schedule.yml} (100%) rename ciw/tests/{datafortesting => testing_parameters}/sample_empirical_dist.csv (100%) diff --git a/ciw/tests/test_arrival_node.py b/ciw/tests/test_arrival_node.py index 31523d6f..97ca897e 100644 --- a/ciw/tests/test_arrival_node.py +++ b/ciw/tests/test_arrival_node.py @@ -14,7 +14,7 @@ class TestArrivalNode(unittest.TestCase): def test_init_method(self): set_seed(5) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual(round(N.next_event_date, 5), 0.00440) self.assertEqual(N.number_of_individuals, 0) @@ -29,7 +29,7 @@ def test_init_method(self): def test_initialise_event_dates_dict_method(self): set_seed(6) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) dates_dict_1 = {1: {0: 0.4362282541, 1: 0.2672232406, 2: 0.3864256273}, 2: {0: 0.1636952311, 1: 0.0714709565, 2: 0.8065738414}, @@ -49,14 +49,14 @@ def test_initialise_event_dates_dict_method(self): def test_repr_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual(str(N), 'Arrival Node') def test_find_next_event_date_method(self): set_seed(1) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual(round(N.next_event_date, 5), 0.00105) N.find_next_event_date() @@ -72,7 +72,7 @@ def test_find_next_event_date_method(self): def test_have_event_method(self): set_seed(1) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual([str(obj) for obj in Q.transitive_nodes[0].individuals], []) self.assertEqual([str(obj) for obj in Q.transitive_nodes[1].individuals], []) @@ -91,7 +91,7 @@ def test_have_event_method(self): set_seed(12) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual([str(obj) for obj in Q.transitive_nodes[0].individuals], []) self.assertEqual([str(obj) for obj in Q.transitive_nodes[1].individuals], []) @@ -110,7 +110,7 @@ def test_have_event_method(self): def test_no_arrivals_example(self): params = ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + 'ciw/tests/testing_parameters/params.yml') params['Arrival_distributions']['Class 0'] = ['NoArrivals', ['Exponential', 1.0], ['Exponential', 4.0], diff --git a/ciw/tests/test_network.py b/ciw/tests/test_network.py index 9ec15251..7c8af414 100644 --- a/ciw/tests/test_network.py +++ b/ciw/tests/test_network.py @@ -154,7 +154,7 @@ def test_network_from_dictionary(self): def test_network_from_file(self): N = ciw.Network_From_File( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + 'ciw/tests/testing_parameters/params.yml') self.assertEqual(N.number_of_service_centres, 4) self.assertEqual(N.number_of_customer_classes, 3) self.assertEqual(N.service_centres[0].queueing_capacity, 20) diff --git a/ciw/tests/test_node.py b/ciw/tests/test_node.py index 6037cd23..5cd68c41 100644 --- a/ciw/tests/test_node.py +++ b/ciw/tests/test_node.py @@ -13,7 +13,7 @@ class TestNode(unittest.TestCase): def test_init_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = ciw.Node(1, Q) self.assertEqual(N.mu, [['Exponential', 7.0], ['Exponential', 7.0], @@ -27,7 +27,7 @@ def test_init_method(self): self.assertEqual(N.id_number, 1) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_dynamic_classes/parameters.yml')) + 'ciw/tests/testing_parameters/params_change_class.yml')) N1 = Q.transitive_nodes[0] self.assertEqual(N1.class_change, [[0.5, 0.5], [0.5, 0.5]]) @@ -35,7 +35,7 @@ def test_init_method(self): self.assertEqual(N2.class_change, [[1.0, 0.0], [0.0, 1.0]]) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml')) + 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] self.assertEqual(N.scheduled_servers, True) self.assertEqual(N.cyclelength, 100) @@ -47,7 +47,7 @@ def test_init_method(self): def test_repr_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N1 = ciw.Node(1, Q) N2 = ciw.Node(2, Q) self.assertEqual(str(N1), 'Node 1') @@ -55,7 +55,7 @@ def test_repr_method(self): def test_change_shift_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml')) + 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] N.next_event_date = 30 self.assertEqual([str(obs) for obs in N.servers], @@ -86,7 +86,7 @@ def test_change_shift_method(self): def test_take_servers_off_duty_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml')) + 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] N.add_new_servers(3) self.assertEqual([str(obs) for obs in N.servers], @@ -108,7 +108,7 @@ def test_take_servers_off_duty_method(self): def test_check_if_shiftchange_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml')) + 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] N.next_event_date = 12.0 self.assertEqual(N.check_if_shiftchange(), False) @@ -116,7 +116,7 @@ def test_check_if_shiftchange_method(self): self.assertEqual(N.check_if_shiftchange(), True) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] N.next_event_date = 12.0 self.assertEqual(N.check_if_shiftchange(), False) @@ -126,7 +126,7 @@ def test_check_if_shiftchange_method(self): def test_finish_service_method(self): set_seed(4) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] inds = [ciw.Individual(i + 1) for i in xrange(3)] for current_time in [0.01, 0.02, 0.03]: @@ -142,7 +142,7 @@ def test_finish_service_method(self): def test_change_customer_class_method(self): set_seed(14) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_dynamic_classes/parameters.yml')) + 'ciw/tests/testing_parameters/params_change_class.yml')) N1 = Q.transitive_nodes[0] ind = ciw.Individual(254, 0) self.assertEqual(ind.customer_class, 0) @@ -163,7 +163,7 @@ def test_change_customer_class_method(self): def test_block_individual_method(self): set_seed(4) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml')) + 'ciw/tests/testing_parameters/params_deadlock.yml')) inds = [ciw.Individual(i + 1) for i in xrange(7)] N1 = Q.transitive_nodes[0] N1.individuals = inds[:6] @@ -185,7 +185,7 @@ def test_block_individual_method(self): def test_release_method(self): set_seed(4) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] inds = [ciw.Individual(i+1) for i in xrange(3)] for current_time in [0.01, 0.02, 0.03]: @@ -206,7 +206,7 @@ def test_release_method(self): def test_begin_service_if_possible_release_method(self): set_seed(50) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml')) + 'ciw/tests/testing_parameters/params_deadlock.yml')) inds = [ciw.Individual(i) for i in xrange(30)] Q.transitive_nodes[0].individuals = inds ind = Q.transitive_nodes[0].individuals[0] @@ -235,7 +235,7 @@ def test_begin_service_if_possible_release_method(self): def test_release_blocked_individual_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml')) + 'ciw/tests/testing_parameters/params_deadlock.yml')) N1 = Q.transitive_nodes[0] N2 = Q.transitive_nodes[1] N1.individuals = [ciw.Individual(i) for i in xrange(N1.c + 3)] @@ -312,7 +312,7 @@ def test_release_blocked_individual_method(self): def test_accept_method(self): set_seed(6) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] N.next_event_date = 0.0 self.assertEqual(N.individuals, []) @@ -372,7 +372,7 @@ def test_accept_method(self): def test_begin_service_if_possible_accept_method(self): set_seed(50) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml')) + 'ciw/tests/testing_parameters/params_deadlock.yml')) ind = ciw.Individual(1) self.assertEqual(Q.digraph.nodes(), ['Server 5 at Node 2', @@ -397,7 +397,7 @@ def test_begin_service_if_possible_accept_method(self): def test_kill_server_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml')) + 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] s = N.servers[0] self.assertEqual([str(obs) for obs in N.servers], @@ -421,7 +421,7 @@ def test_kill_server_method(self): def test_add_new_servers_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml')) + 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] self.assertEqual([str(obs) for obs in N.servers], ['Server 1 at Node 1']) @@ -435,7 +435,7 @@ def test_add_new_servers_method(self): def test_update_next_event_date_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] self.assertEqual(N.next_event_date, 'Inf') self.assertEqual(N.individuals, []) @@ -468,7 +468,7 @@ def test_update_next_event_date_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml')) + 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] self.assertEqual(N.next_event_date, 30) self.assertEqual(N.individuals, []) @@ -490,7 +490,7 @@ def test_update_next_event_date_method(self): def test_next_node_method(self): set_seed(6) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) node = Q.transitive_nodes[0] self.assertEqual(str(node.next_node(0)), 'Exit Node') self.assertEqual(str(node.next_node(0)), 'Node 3') @@ -501,7 +501,7 @@ def test_next_node_method(self): set_seed(54) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) node = Q.transitive_nodes[2] self.assertEqual(str(node.next_node(0)), 'Node 2') self.assertEqual(str(node.next_node(0)), 'Node 2') @@ -515,7 +515,7 @@ def test_next_node_method(self): def test_write_individual_record_method(self): set_seed(7) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] ind = ciw.Individual(6) N.accept(ind, 3) @@ -533,7 +533,7 @@ def test_write_individual_record_method(self): def test_date_from_schedule_generator(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) sg = Q.nodes[1].date_from_schedule_generator([30, 60, 90, 100]) self.assertEqual(sg.next(), 30) diff --git a/ciw/tests/test_sampling.py b/ciw/tests/test_sampling.py index dedeea20..60980408 100644 --- a/ciw/tests/test_sampling.py +++ b/ciw/tests/test_sampling.py @@ -493,7 +493,7 @@ def test_sampling_weibull_dist_hypothesis(self, wa, wb, rm): def test_sampling_empirical_dist(self): my_empirical_dist = [8.0, 8.0, 8.0, 8.8, 8.8, 12.3] Arrival_distributions = [['Empirical', - 'ciw/tests/datafortesting/sample_empirical_dist.csv']] + 'ciw/tests/testing_parameters/sample_empirical_dist.csv']] Service_distributions = [['Empirical', my_empirical_dist]] Number_of_servers = [1] Transition_matrices = [[0.1]] @@ -534,7 +534,7 @@ def test_sampling_empirical_dist_hypothesis(self, dist, rm): my_empirical_dist = dist Arrival_distributions = [['Empirical', my_empirical_dist]] Service_distributions = [['Empirical', - 'ciw/tests/datafortesting/sample_empirical_dist.csv']] + 'ciw/tests/testing_parameters/sample_empirical_dist.csv']] Number_of_servers = [1] Transition_matrices = [[0.1]] Simulation_time = 2222 @@ -808,7 +808,7 @@ def test_error_dist(self): rm=random_module()) def test_check_userdef_dist(self, positive_float, negative_float, word, rm): assume(negative_float < 0) - Q = ciw.Simulation(ciw.load_parameters('ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + Q = ciw.Simulation(ciw.load_parameters('ciw/tests/testing_parameters/params.yml')) self.assertEqual(Q.check_userdef_dist(lambda : positive_float), positive_float) self.assertRaises(ValueError, Q.check_userdef_dist, lambda : negative_float) self.assertRaises(ValueError, Q.check_userdef_dist, lambda : word) diff --git a/ciw/tests/test_server.py b/ciw/tests/test_server.py index ade52b5a..374b025e 100644 --- a/ciw/tests/test_server.py +++ b/ciw/tests/test_server.py @@ -7,7 +7,7 @@ class TestServer(unittest.TestCase): def test_init_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[1] s = ciw.Server(N, 3) self.assertEqual(s.id_number, 3) @@ -19,7 +19,7 @@ def test_init_method(self): def test_repr_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] s = ciw.Server(N, 4) self.assertEqual(str(s), 'Server 4 at Node 1') \ No newline at end of file diff --git a/ciw/tests/test_simulation.py b/ciw/tests/test_simulation.py index 12098d51..8aab4180 100644 --- a/ciw/tests/test_simulation.py +++ b/ciw/tests/test_simulation.py @@ -16,19 +16,19 @@ class TestSimulation(unittest.TestCase): def test_repr_method(self): params1 = ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(params1) self.assertEqual(str(Q), 'Simulation') params2 = ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + 'ciw/tests/testing_parameters/params.yml') params2['Name'] = 'My special simulation instance!' Q = ciw.Simulation(params2) self.assertEqual(str(Q), 'My special simulation instance!') def test_init_method_from_dict(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) self.assertEqual(Q.lmbda, [[['Exponential', 3.0], ['Exponential', 7.0], ['Exponential', 4.0], @@ -77,13 +77,13 @@ def test_init_method_from_dict(self): self.assertEqual(Q.schedules, [False, False, False, False]) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_dynamic_classes/parameters.yml')) + 'ciw/tests/testing_parameters/params_change_class.yml')) self.assertEqual(Q.class_change_matrix, [[[0.5, 0.5], [0.5, 0.5]], [[1.0, 0.0], [0.0, 1.0]]]) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml')) + 'ciw/tests/testing_parameters/params_schedule.yml')) self.assertEqual(Q.schedules, [True, False]) @@ -444,7 +444,7 @@ def test_build_mmc_parameters(self, def test_find_next_active_node_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) i = 0 for node in Q.nodes[:-1]: node.next_event_date = i @@ -452,7 +452,7 @@ def test_find_next_active_node_method(self): self.assertEqual(str(Q.find_next_active_node()), 'Arrival Node') Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) i = 10 for node in Q.nodes[:-1]: node.next_event_date = i @@ -462,7 +462,7 @@ def test_find_next_active_node_method(self): def test_simulate_until_max_time_method(self): set_seed(2) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) Q.simulate_until_max_time(150) L = Q.get_all_individuals() self.assertEqual(round( @@ -470,7 +470,7 @@ def test_simulate_until_max_time_method(self): set_seed(60) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_dynamic_classes/parameters.yml')) + 'ciw/tests/testing_parameters/params_change_class.yml')) Q.simulate_until_max_time(50) L = Q.get_all_individuals() drl = [] @@ -481,13 +481,13 @@ def test_simulate_until_max_time_method(self): def test_simulate_until_deadlock_method(self): set_seed(3) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml')) + 'ciw/tests/testing_parameters/params_deadlock.yml')) Q.simulate_until_deadlock() self.assertEqual(round(Q.times_to_deadlock[((0, 0), (0, 0))], 8), 31.26985409) def test_detect_deadlock_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) nodes = ['A', 'B', 'C', 'D', 'E'] connections = [('A', 'D'), ('A', 'B'), ('B', 'E'), ('C', 'B'), ('E', 'C')] for nd in nodes: @@ -497,7 +497,7 @@ def test_detect_deadlock_method(self): self.assertEqual(Q.detect_deadlock(), True) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) nodes = ['A', 'B', 'C', 'D'] connections = [('A', 'B'), ('A', 'C'), ('B', 'C'), ('B', 'D')] for nd in nodes: @@ -507,7 +507,7 @@ def test_detect_deadlock_method(self): self.assertEqual(Q.detect_deadlock(), False) Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) nodes = ['A', 'B'] for nd in nodes: Q.digraph.add_node(nd) @@ -519,7 +519,7 @@ def test_detect_deadlock_method(self): def test_mm1_from_file(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_mm1/parameters.yml')) + 'ciw/tests/testing_parameters/params_mm1.yml')) self.assertEqual(Q.transition_matrix, [[[0.0]]]) @given(arrival_rate=floats(min_value=0.1, max_value=10), @@ -609,30 +609,30 @@ def test_raising_errors(self): def test_writing_data_files(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) Q.simulate_until_max_time(50) files = [x for x in os.walk( - 'ciw/tests/datafortesting/logs_test_for_simulation/')][0][2] + 'ciw/tests/testing_parameters/')][0][2] self.assertEqual('data.csv' in files, False) Q.write_records_to_file( - 'ciw/tests/datafortesting/logs_test_for_simulation/data.csv') + 'ciw/tests/testing_parameters/data.csv') files = [x for x in os.walk( - 'ciw/tests/datafortesting/logs_test_for_simulation/')][0][2] + 'ciw/tests/testing_parameters/')][0][2] self.assertEqual('data.csv' in files, True) - os.remove('ciw/tests/datafortesting/logs_test_for_simulation/data.csv') + os.remove('ciw/tests/testing_parameters/data.csv') Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_mm1/parameters.yml')) + 'ciw/tests/testing_parameters/params_mm1.yml')) Q.simulate_until_max_time(50) files = [x for x in os.walk( - 'ciw/tests/datafortesting/logs_test_for_mm1/')][0][2] + 'ciw/tests/testing_parameters/')][0][2] self.assertEqual('data_1.csv' in files, False) Q.write_records_to_file( - 'ciw/tests/datafortesting/logs_test_for_mm1/data_1.csv', False) + 'ciw/tests/testing_parameters/data_1.csv', False) files = [x for x in os.walk( - 'ciw/tests/datafortesting/logs_test_for_mm1/')][0][2] + 'ciw/tests/testing_parameters/')][0][2] self.assertEqual('data_1.csv' in files, True) - os.remove('ciw/tests/datafortesting/logs_test_for_mm1/data_1.csv') + os.remove('ciw/tests/testing_parameters/data_1.csv') def test_simultaneous_events_example(self): # This should yield 3 or 2 customers finishing service. diff --git a/ciw/tests/test_state_tracker.py b/ciw/tests/test_state_tracker.py index b7a18463..f22087a7 100644 --- a/ciw/tests/test_state_tracker.py +++ b/ciw/tests/test_state_tracker.py @@ -5,14 +5,14 @@ class TestStateTracker(unittest.TestCase): def test_base_init_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.simulation, Q) self.assertEqual(B.state, None) def test_base_change_state_accept_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.state, None) B.change_state_accept(1, 1) @@ -20,7 +20,7 @@ def test_base_change_state_accept_method(self): def test_base_change_state_block_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.state, None) B.change_state_block(1, 1, 1) @@ -28,7 +28,7 @@ def test_base_change_state_block_method(self): def test_base_change_state_release_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.state, None) B.change_state_release(1, 1, 1, True) @@ -36,13 +36,13 @@ def test_base_change_state_release_method(self): def test_base_hash_state_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.hash_state(), None) def test_base_release_method_within_simulation(self): params = ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(params) N = Q.transitive_nodes[2] inds = [ciw.Individual(i) for i in xrange(5)] @@ -61,7 +61,7 @@ def test_base_release_method_within_simulation(self): def test_base_block_method_within_simulation(self): params = ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(params) N = Q.transitive_nodes[2] self.assertEqual(Q.statetracker.state, None) @@ -70,7 +70,7 @@ def test_base_block_method_within_simulation(self): def test_base_accept_method_within_simulation(self): params = ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(params) N = Q.transitive_nodes[2] self.assertEqual(Q.statetracker.state, None) @@ -84,14 +84,14 @@ class TestNaiveTracker(unittest.TestCase): def test_naive_init_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) self.assertEqual(B.simulation, Q) self.assertEqual(B.state, [[0, 0], [0, 0], [0, 0], [0, 0]]) def test_naive_change_state_accept_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) self.assertEqual(B.state, [[0, 0], [0, 0], [0, 0], [0, 0]]) B.change_state_accept(1, 1) @@ -99,7 +99,7 @@ def test_naive_change_state_accept_method(self): def test_naive_change_state_block_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) B.state = [[1, 0], [0, 0], [0, 0], [0, 0]] B.change_state_block(1, 1, 2) @@ -107,7 +107,7 @@ def test_naive_change_state_block_method(self): def test_naive_change_state_release_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) B.state = [[2, 1], [3, 0], [1, 0], [4, 4]] B.change_state_release(1, 1, 2, False) @@ -117,14 +117,14 @@ def test_naive_change_state_release_method(self): def test_naive_hash_state_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) B.state = [[3, 4], [1, 2], [0, 1], [0, 0]] self.assertEqual(B.hash_state(), ((3, 4), (1, 2), (0, 1), (0, 0))) def test_naive_release_method_within_simulation(self): params = ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + 'ciw/tests/testing_parameters/params.yml') params['Tracker'] = 'Naive' Q = ciw.Simulation(params) N = Q.transitive_nodes[2] @@ -145,7 +145,7 @@ def test_naive_release_method_within_simulation(self): def test_naive_block_method_within_simulation(self): params = ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + 'ciw/tests/testing_parameters/params.yml') params['Tracker'] = 'Naive' Q = ciw.Simulation(params) N = Q.transitive_nodes[2] @@ -156,7 +156,7 @@ def test_naive_block_method_within_simulation(self): def test_naive_accept_method_within_simulation(self): params = ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + 'ciw/tests/testing_parameters/params.yml') params['Tracker'] = 'Naive' Q = ciw.Simulation(params) N = Q.transitive_nodes[2] @@ -171,7 +171,7 @@ class TestMatrixTracker(unittest.TestCase): def test_matrix_init_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) self.assertEqual(B.simulation, Q) self.assertEqual(B.state, [[[[], [], [], []], @@ -182,7 +182,7 @@ def test_matrix_init_method(self): def test_matrix_change_state_accept_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) self.assertEqual(B.state, [[[[], [], [], []], [[], [], [], []], @@ -198,7 +198,7 @@ def test_matrix_change_state_accept_method(self): def test_matrix_change_state_block_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) B.state = [[[[], [], [], []], [[], [], [], []], @@ -226,7 +226,7 @@ def test_matrix_change_state_block_method(self): def test_matrix_change_state_release_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) B.state = [[[[], [], [1, 3], []], [[2], [], [], []], @@ -248,7 +248,7 @@ def test_matrix_change_state_release_method(self): def test_matrix_hash_state_method(self): Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml')) + 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) B.state = [[[[], [], [1, 3], []], [[2], [], [], []], @@ -263,7 +263,7 @@ def test_matrix_hash_state_method(self): def test_matrix_release_method_within_simulation(self): params = ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + 'ciw/tests/testing_parameters/params.yml') params['Tracker'] = 'Matrix' Q = ciw.Simulation(params) N = Q.transitive_nodes[2] @@ -305,7 +305,7 @@ def test_matrix_release_method_within_simulation(self): def test_matrix_block_method_within_simulation(self): params = ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + 'ciw/tests/testing_parameters/params.yml') params['Tracker'] = 'Matrix' Q = ciw.Simulation(params) N = Q.transitive_nodes[2] @@ -329,7 +329,7 @@ def test_matrix_block_method_within_simulation(self): def test_matrix_accept_method_within_simulation(self): params = ciw.load_parameters( - 'ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml') + 'ciw/tests/testing_parameters/params.yml') params['Tracker'] = 'Matrix' Q = ciw.Simulation(params) N = Q.transitive_nodes[2] diff --git a/ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml b/ciw/tests/testing_parameters/params.yml similarity index 100% rename from ciw/tests/datafortesting/logs_test_for_simulation/parameters.yml rename to ciw/tests/testing_parameters/params.yml diff --git a/ciw/tests/datafortesting/logs_test_for_dynamic_classes/parameters.yml b/ciw/tests/testing_parameters/params_change_class.yml similarity index 100% rename from ciw/tests/datafortesting/logs_test_for_dynamic_classes/parameters.yml rename to ciw/tests/testing_parameters/params_change_class.yml diff --git a/ciw/tests/datafortesting/logs_test_for_custom_dist/parameters.yml b/ciw/tests/testing_parameters/params_custom_dist.yml similarity index 100% rename from ciw/tests/datafortesting/logs_test_for_custom_dist/parameters.yml rename to ciw/tests/testing_parameters/params_custom_dist.yml diff --git a/ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml b/ciw/tests/testing_parameters/params_deadlock.yml similarity index 100% rename from ciw/tests/datafortesting/logs_test_for_deadlock_sim/parameters.yml rename to ciw/tests/testing_parameters/params_deadlock.yml diff --git a/ciw/tests/datafortesting/logs_test_for_mm1/parameters.yml b/ciw/tests/testing_parameters/params_mm1.yml similarity index 100% rename from ciw/tests/datafortesting/logs_test_for_mm1/parameters.yml rename to ciw/tests/testing_parameters/params_mm1.yml diff --git a/ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml b/ciw/tests/testing_parameters/params_schedule.yml similarity index 100% rename from ciw/tests/datafortesting/logs_test_for_server_schedule/parameters.yml rename to ciw/tests/testing_parameters/params_schedule.yml diff --git a/ciw/tests/datafortesting/sample_empirical_dist.csv b/ciw/tests/testing_parameters/sample_empirical_dist.csv similarity index 100% rename from ciw/tests/datafortesting/sample_empirical_dist.csv rename to ciw/tests/testing_parameters/sample_empirical_dist.csv From 4b72485894dc66272ebaa4d0ceabff26cb495d30 Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Tue, 19 Apr 2016 18:30:31 +0100 Subject: [PATCH 15/20] Simulation now takes Network object, errorchecking not working --- .../3a76e75eadfd834a/027161d864812d11 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/2ddd3bb26f3bc246 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/2f9174402dc776a0 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/4b1b22fcd376699a | Bin 0 -> 33 bytes .../3a76e75eadfd834a/4c4a1ad1808e8793 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/56df8f1b878f1a0f | Bin 0 -> 33 bytes .../3a76e75eadfd834a/6458b181965bfc5f | Bin 0 -> 33 bytes .../3a76e75eadfd834a/71993c1874712357 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/795020d55a8c0fd2 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/894b3b015f4be73f | Bin 0 -> 33 bytes .../3a76e75eadfd834a/8d14c1b027755284 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/a6f336ff02dfc8e2 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/ae60e69a62faece9 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/be4e9a78e95e6e9f | Bin 0 -> 33 bytes .../3a76e75eadfd834a/caf93b5657909f1c | Bin 0 -> 33 bytes .../3a76e75eadfd834a/d1d33196d1d7ba30 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/d674c5e0f2a174b7 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/df372d94c3bbb9a9 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/e030f354ecd7fd78 | Bin 0 -> 33 bytes .../3a76e75eadfd834a/e081004e3549b80e | Bin 0 -> 33 bytes .../8cdadbd5254dc03d/089f60268c6fcced | Bin 0 -> 33 bytes .../8cdadbd5254dc03d/0d2a540449577232 | Bin 0 -> 33 bytes .../8cdadbd5254dc03d/17d8254d77c67fe1 | Bin 0 -> 33 bytes .../8cdadbd5254dc03d/4b1b22fcd376699a | Bin 0 -> 33 bytes .../8cdadbd5254dc03d/4ca0fcabc0c80cd3 | Bin 0 -> 33 bytes .../8cdadbd5254dc03d/543c6188474932b8 | Bin 0 -> 33 bytes .../8cdadbd5254dc03d/6d7b714c574b345d | Bin 0 -> 33 bytes .../8cdadbd5254dc03d/b58b8a661a895d65 | Bin 0 -> 33 bytes .../8cdadbd5254dc03d/b9470af369bb76eb | Bin 0 -> 33 bytes .../8cdadbd5254dc03d/d5cf7143c6ff2650 | Bin 0 -> 33 bytes .../a40d01c034da88b1/842726a1f97b58d8 | Bin 32 -> 0 bytes ciw/arrival_node.py | 8 +- ciw/exit_node.py | 4 +- ciw/import_params.py | 2 +- ciw/network.py | 4 +- ciw/node.py | 38 +- ciw/simulation.py | 174 ++--- ciw/state_tracker.py | 8 +- ciw/tests/test_arrival_node.py | 24 +- ciw/tests/test_exit_node.py | 18 +- ciw/tests/test_network.py | 20 +- ciw/tests/test_node.py | 66 +- ciw/tests/test_sampling.py | 709 ++++++++---------- ciw/tests/test_server.py | 4 +- ciw/tests/test_simulation.py | 694 ++++------------- ciw/tests/test_state_tracker.py | 72 +- ciw/tests/testing_parameters/params.yml | 1 - .../params_change_class.yml | 5 +- .../testing_parameters/params_custom_dist.yml | 31 +- .../testing_parameters/params_schedule.yml | 1 - 50 files changed, 668 insertions(+), 1215 deletions(-) create mode 100644 .hypothesis/examples/3a76e75eadfd834a/027161d864812d11 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/2ddd3bb26f3bc246 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/2f9174402dc776a0 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/4b1b22fcd376699a create mode 100644 .hypothesis/examples/3a76e75eadfd834a/4c4a1ad1808e8793 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/56df8f1b878f1a0f create mode 100644 .hypothesis/examples/3a76e75eadfd834a/6458b181965bfc5f create mode 100644 .hypothesis/examples/3a76e75eadfd834a/71993c1874712357 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/795020d55a8c0fd2 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/894b3b015f4be73f create mode 100644 .hypothesis/examples/3a76e75eadfd834a/8d14c1b027755284 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/a6f336ff02dfc8e2 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/ae60e69a62faece9 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/be4e9a78e95e6e9f create mode 100644 .hypothesis/examples/3a76e75eadfd834a/caf93b5657909f1c create mode 100644 .hypothesis/examples/3a76e75eadfd834a/d1d33196d1d7ba30 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/d674c5e0f2a174b7 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/df372d94c3bbb9a9 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/e030f354ecd7fd78 create mode 100644 .hypothesis/examples/3a76e75eadfd834a/e081004e3549b80e create mode 100644 .hypothesis/examples/8cdadbd5254dc03d/089f60268c6fcced create mode 100644 .hypothesis/examples/8cdadbd5254dc03d/0d2a540449577232 create mode 100644 .hypothesis/examples/8cdadbd5254dc03d/17d8254d77c67fe1 create mode 100644 .hypothesis/examples/8cdadbd5254dc03d/4b1b22fcd376699a create mode 100644 .hypothesis/examples/8cdadbd5254dc03d/4ca0fcabc0c80cd3 create mode 100644 .hypothesis/examples/8cdadbd5254dc03d/543c6188474932b8 create mode 100644 .hypothesis/examples/8cdadbd5254dc03d/6d7b714c574b345d create mode 100644 .hypothesis/examples/8cdadbd5254dc03d/b58b8a661a895d65 create mode 100644 .hypothesis/examples/8cdadbd5254dc03d/b9470af369bb76eb create mode 100644 .hypothesis/examples/8cdadbd5254dc03d/d5cf7143c6ff2650 delete mode 100644 .hypothesis/examples/a40d01c034da88b1/842726a1f97b58d8 diff --git a/.hypothesis/examples/3a76e75eadfd834a/027161d864812d11 b/.hypothesis/examples/3a76e75eadfd834a/027161d864812d11 new file mode 100644 index 0000000000000000000000000000000000000000..173722b4af7e1d9c87d3defe1033f67de0a3c1c5 GIT binary patch literal 33 YcmcEDIdkTJ2L}iK1_l&hVGor60GE9Tng9R* literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/2ddd3bb26f3bc246 b/.hypothesis/examples/3a76e75eadfd834a/2ddd3bb26f3bc246 new file mode 100644 index 0000000000000000000000000000000000000000..70a826001d69da93f12d6665108cab7bfc101372 GIT binary patch literal 33 WcmcEDITHx>JMcF!pa2Vds009`feC&9 literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/2f9174402dc776a0 b/.hypothesis/examples/3a76e75eadfd834a/2f9174402dc776a0 new file mode 100644 index 0000000000000000000000000000000000000000..314406879ea99c059c65865e47518c408937f290 GIT binary patch literal 33 VcmcEDITHl-^EWV{01JDl1OTj<3NQcw literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/4b1b22fcd376699a b/.hypothesis/examples/3a76e75eadfd834a/4b1b22fcd376699a new file mode 100644 index 0000000000000000000000000000000000000000..ca0fd42fee1dab3b3376d8ff38bf329de411d0e2 GIT binary patch literal 33 ScmcEDITHkCF`xr`s009+LJ1!L literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/4c4a1ad1808e8793 b/.hypothesis/examples/3a76e75eadfd834a/4c4a1ad1808e8793 new file mode 100644 index 0000000000000000000000000000000000000000..b9a453aa4223618a4ae3cd084ddb452f56f01124 GIT binary patch literal 33 YcmcEDIdkTI2L}iK1_l&hVGor60FONg8UO$Q literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/56df8f1b878f1a0f b/.hypothesis/examples/3a76e75eadfd834a/56df8f1b878f1a0f new file mode 100644 index 0000000000000000000000000000000000000000..3f66cf67b952914d863109e7cbdb175e0cd3dea0 GIT binary patch literal 33 XcmcEDx!*y>!NGyQfdK_r*h3`%bd?5v literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/6458b181965bfc5f b/.hypothesis/examples/3a76e75eadfd834a/6458b181965bfc5f new file mode 100644 index 0000000000000000000000000000000000000000..a292fa3b398349af494d74d9a6c5ab14858c1ff8 GIT binary patch literal 33 YcmcEDIdkUB{SFTN4Gbv2!X7FC0GYT5%m4rY literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/71993c1874712357 b/.hypothesis/examples/3a76e75eadfd834a/71993c1874712357 new file mode 100644 index 0000000000000000000000000000000000000000..550ec6e875f8d3ef05edfc17de687de61e6dee96 GIT binary patch literal 33 VcmcEDITHkCF*Gos01JDl1OTTx3D*Ds literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/795020d55a8c0fd2 b/.hypothesis/examples/3a76e75eadfd834a/795020d55a8c0fd2 new file mode 100644 index 0000000000000000000000000000000000000000..d9285366f474530b880f162cf7eb9f53c9acecde GIT binary patch literal 33 dcmZ<=ocKW{C;t+E0|N@MaENf3{h{^gSpboF2}u9| literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/894b3b015f4be73f b/.hypothesis/examples/3a76e75eadfd834a/894b3b015f4be73f new file mode 100644 index 0000000000000000000000000000000000000000..62f1a41ee0fcb1c037a7e608df503d7ccd1a2ce8 GIT binary patch literal 33 YcmZ<=ocKW{C;t+E0|N@MaDYkx0FYe>jsO4v literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/8d14c1b027755284 b/.hypothesis/examples/3a76e75eadfd834a/8d14c1b027755284 new file mode 100644 index 0000000000000000000000000000000000000000..4a013507e3b7bbfae441f2e3cd688ba43094eef6 GIT binary patch literal 33 XcmcEj@8F=~;NZaDz<>fQ?4c3>Y~%(E literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/a6f336ff02dfc8e2 b/.hypothesis/examples/3a76e75eadfd834a/a6f336ff02dfc8e2 new file mode 100644 index 0000000000000000000000000000000000000000..a0d8eb57161e939bfe78da677824a5c18cbd1a17 GIT binary patch literal 33 XcmZ>8aBxroV*UmO6kq`q14{q^PxJ(k literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/ae60e69a62faece9 b/.hypothesis/examples/3a76e75eadfd834a/ae60e69a62faece9 new file mode 100644 index 0000000000000000000000000000000000000000..3c5a92f3b830f8946d792baea6ea8f9203e8d908 GIT binary patch literal 33 XcmcED`QJgs!NGyQfdK_r*h3`%ebom3 literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/be4e9a78e95e6e9f b/.hypothesis/examples/3a76e75eadfd834a/be4e9a78e95e6e9f new file mode 100644 index 0000000000000000000000000000000000000000..67bcb53e106877c5b42682de6f97f2cee347cb9e GIT binary patch literal 33 YcmcEDIrG1YgM$Nq0|N@Mu!l+j0EsjQumAu6 literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/caf93b5657909f1c b/.hypothesis/examples/3a76e75eadfd834a/caf93b5657909f1c new file mode 100644 index 0000000000000000000000000000000000000000..3ac39914dda65f49ce2f4fbf8194f5d2df36e433 GIT binary patch literal 33 YcmcEDIdi{?gM$Nq0|N@Mu!l+j0DyD{FaQ7m literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/3a76e75eadfd834a/d1d33196d1d7ba30 b/.hypothesis/examples/3a76e75eadfd834a/d1d33196d1d7ba30 new file mode 100644 index 0000000000000000000000000000000000000000..70f26565fb5b821e2872caeff3f24874decb1197 GIT binary patch literal 33 XcmcED@8F=~;NZaDz<>fQ?4c3>V99WQ@vU=Ni500G+&D*ylh literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/8cdadbd5254dc03d/0d2a540449577232 b/.hypothesis/examples/8cdadbd5254dc03d/0d2a540449577232 new file mode 100644 index 0000000000000000000000000000000000000000..1439852749a6037da892f1b31f71881e42cf2c90 GIT binary patch literal 33 hcmcEDITHx>I|woW!K27+yG#0%E*&p_ZD0?T008`)55oWe literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/8cdadbd5254dc03d/17d8254d77c67fe1 b/.hypothesis/examples/8cdadbd5254dc03d/17d8254d77c67fe1 new file mode 100644 index 0000000000000000000000000000000000000000..435ce12e326a6c27c51864da93eb1b22f53d795b GIT binary patch literal 33 icmcEDIdkTJ2L}g11|WD8xovkzpVFn{<*yCwp%MV_m=50n literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/8cdadbd5254dc03d/4b1b22fcd376699a b/.hypothesis/examples/8cdadbd5254dc03d/4b1b22fcd376699a new file mode 100644 index 0000000000000000000000000000000000000000..ca0fd42fee1dab3b3376d8ff38bf329de411d0e2 GIT binary patch literal 33 ScmcEDITHkCF`xr`s009+LJ1!L literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/8cdadbd5254dc03d/4ca0fcabc0c80cd3 b/.hypothesis/examples/8cdadbd5254dc03d/4ca0fcabc0c80cd3 new file mode 100644 index 0000000000000000000000000000000000000000..b1d89b221cf98993b4be283e465880fe8a249946 GIT binary patch literal 33 gcmcEDITHl_3o-z~qsVQ$OZt>99WQ@vU=Ni501Sc<^#A|> literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/8cdadbd5254dc03d/543c6188474932b8 b/.hypothesis/examples/8cdadbd5254dc03d/543c6188474932b8 new file mode 100644 index 0000000000000000000000000000000000000000..97b4760ef17e5f695844911387a14020e4405607 GIT binary patch literal 33 fcmcEDITHkCF@V6M$Zfkz`jjpmFMn-d50wA_05T97 literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/8cdadbd5254dc03d/6d7b714c574b345d b/.hypothesis/examples/8cdadbd5254dc03d/6d7b714c574b345d new file mode 100644 index 0000000000000000000000000000000000000000..bf377638185989f825a7beb443cb38a38dc9227d GIT binary patch literal 33 icmcEDIdkUB{|*j<3_$QGa@+2bKBY^?%U>JVLnQ$ElMj&q literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/8cdadbd5254dc03d/b58b8a661a895d65 b/.hypothesis/examples/8cdadbd5254dc03d/b58b8a661a895d65 new file mode 100644 index 0000000000000000000000000000000000000000..b0566c9975f20aeb47c7019f096a44b118c168fc GIT binary patch literal 33 hcmcEDITHx}I|woW!K27+yG#0%E*&p_ZD0?T000B)5JLa} literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/8cdadbd5254dc03d/b9470af369bb76eb b/.hypothesis/examples/8cdadbd5254dc03d/b9470af369bb76eb new file mode 100644 index 0000000000000000000000000000000000000000..468c7330672a6993267ef59b6bd4e956186c3129 GIT binary patch literal 33 icmcEDIdkTI2L}g11|WD8xovkzpVFn{<*yCwp%MV-SPowR literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/8cdadbd5254dc03d/d5cf7143c6ff2650 b/.hypothesis/examples/8cdadbd5254dc03d/d5cf7143c6ff2650 new file mode 100644 index 0000000000000000000000000000000000000000..8d72162c86d7079ed905297654fc996b787d70c2 GIT binary patch literal 33 gcmcEDITHl-3o-z~qsVQ$OZt>99WQ@vU=Ni500qJjbpQYW literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/842726a1f97b58d8 b/.hypothesis/examples/a40d01c034da88b1/842726a1f97b58d8 deleted file mode 100644 index e6b2e4126fb9e9b2f638b1ba8a0685f0468d9243..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 ScmcEDITHkCF`xl^s5k(WvI!pm diff --git a/ciw/arrival_node.py b/ciw/arrival_node.py index cc6d24a5..d828f0a7 100644 --- a/ciw/arrival_node.py +++ b/ciw/arrival_node.py @@ -13,11 +13,11 @@ def __init__(self, simulation): self.simulation = simulation self.number_of_individuals = 0 self.event_dates_dict = {nd + 1: {cls:False for cls in range( - self.simulation.parameters['Number_of_classes'])} - for nd in range(self.simulation.number_of_nodes)} + self.simulation.network.number_of_classes)} + for nd in range(self.simulation.network.number_of_nodes)} self.rejection_dict = {nd + 1: {cls:[] for cls in range( - self.simulation.parameters['Number_of_classes'])} - for nd in range(self.simulation.number_of_nodes)} + self.simulation.network.number_of_classes)} + for nd in range(self.simulation.network.number_of_nodes)} self.initialise_event_dates_dict() self.find_next_event_date() diff --git a/ciw/exit_node.py b/ciw/exit_node.py index be61bd3f..830450ed 100644 --- a/ciw/exit_node.py +++ b/ciw/exit_node.py @@ -4,13 +4,13 @@ class ExitNode: """ Class for the exit node on our network """ - def __init__(self, max_simulation_time): + def __init__(self): """ Initialise a node. """ self.individuals = [] self.id_number = -1 - self.next_event_date = max_simulation_time + self.next_event_date = "Inf" self.node_capacity = "Inf" def __repr__(self): diff --git a/ciw/import_params.py b/ciw/import_params.py index ddd933b3..e2574205 100644 --- a/ciw/import_params.py +++ b/ciw/import_params.py @@ -42,7 +42,7 @@ def Network_From_Dictionary(params): {'Node ' + str(nd + 1): None for nd in xrange(number_of_nodes)}) number_of_servers, schedules, nodes, classes = [], [], [], [] for c in params['Number_of_servers']: - if isinstance(c, str): + if isinstance(c, str) and c != 'Inf': number_of_servers.append('schedule') schedules.append(params[c]) else: diff --git a/ciw/network.py b/ciw/network.py index 781845c1..7afa4d1d 100644 --- a/ciw/network.py +++ b/ciw/network.py @@ -41,5 +41,5 @@ def __init__(self, service_centres, customer_classes): """ self.service_centres = service_centres self.customer_classes = customer_classes - self.number_of_service_centres = len(service_centres) - self.number_of_customer_classes = len(customer_classes) \ No newline at end of file + self.number_of_nodes = len(service_centres) + self.number_of_classes = len(customer_classes) \ No newline at end of file diff --git a/ciw/node.py b/ciw/node.py index a5138b1b..8f1b9155 100644 --- a/ciw/node.py +++ b/ciw/node.py @@ -19,38 +19,32 @@ def __init__(self, id_, simulation): Initialise a node. """ self.simulation = simulation - self.mu = [self.simulation.mu[cls][id_ - 1] - for cls in xrange(len(self.simulation.mu))] - self.scheduled_servers = self.simulation.schedules[id_ - 1] - if self.scheduled_servers: - raw_schedule = self.simulation.parameters[ - self.simulation.c[id_ - 1]] + node = self.simulation.network.service_centres[id_ - 1] + if node.schedule: + raw_schedule = node.schedule self.cyclelength = self.increment_time(0, raw_schedule[-1][0]) boundaries = [0] + [row[0] for row in raw_schedule[:-1]] servers = [row[1] for row in raw_schedule] self.schedule = [list(pair) for pair in zip(boundaries, servers)] self.c = self.schedule[0][1] - raw_schedule_boundaries = [row[0] for row in raw_schedule] self.date_generator = self.date_from_schedule_generator(raw_schedule_boundaries) self.next_shift_change = self.date_generator.next() - else: - self.c = self.simulation.c[id_ - 1] - if self.simulation.queue_capacities[id_ - 1] == "Inf": + self.c = node.number_of_servers + self.schedule = None + if node.queueing_capacity == "Inf": self.node_capacity = "Inf" else: - self.node_capacity = self.simulation.queue_capacities[ - id_ - 1] + self.c - self.transition_row = [self.simulation.transition_matrix[j][ - id_ - 1] for j in xrange(len( - self.simulation.transition_matrix))] - if self.simulation.class_change_matrix != 'NA': - self.class_change = self.simulation.class_change_matrix[ - id_ - 1] + self.node_capacity = node.queueing_capacity + self.c + self.transition_row = [ + self.simulation.network.customer_classes[ + cls].transition_matrix[id_ - 1] for cls in xrange( + self.simulation.network.number_of_classes)] + self.class_change = node.class_change_matrix self.individuals = [] self.id_number = id_ - if self.scheduled_servers: + if self.schedule: self.next_event_date = self.next_shift_change else: self.next_event_date = "Inf" @@ -162,7 +156,7 @@ def change_customer_class(self,individual): Takes individual and changes customer class according to a probability distribution. """ - if self.simulation.class_change_matrix != 'NA': + if self.class_change: individual.previous_class = individual.customer_class individual.customer_class = nprandom.choice( xrange(len(self.class_change)), @@ -193,7 +187,7 @@ def check_if_shiftchange(self): """ Check whether current time is a shift change. """ - if self.scheduled_servers: + if self.schedule: return self.next_event_date == self.next_shift_change return False @@ -343,7 +337,7 @@ def update_next_event_date(self, current_time): for ind in self.individuals if not ind.is_blocked if ind.service_end_date >= current_time] + ["Inf"]) - if self.scheduled_servers: + if self.schedule: next_shift_change = self.next_shift_change self.next_event_date = min( next_end_service, next_shift_change) diff --git a/ciw/simulation.py b/ciw/simulation.py index 36949ac7..de425c2c 100644 --- a/ciw/simulation.py +++ b/ciw/simulation.py @@ -23,55 +23,29 @@ class Simulation: """ Overall simulation class """ - def __init__(self, *args, **kwargs): + def __init__(self, network, exact=False, name='Simulation', tracker=False, deadlock_detector=False): """ Initialise a queue instance. """ - if args: - parameters = copy.deepcopy(args[0]) - else: - parameters = kwargs - self.parameters = self.build_parameters(parameters) - self.check_valid_parameters() - if not self.parameters['Exact']: + self.network = network + # self.check_valid_parameters(network) + if not exact: NodeType = Node ArrivalNodeType = ArrivalNode else: NodeType = ExactNode ArrivalNodeType = ExactArrivalNode - getcontext().prec = self.parameters['Exact'] - self.name = self.parameters['Name'] - self.c = self.parameters['Number_of_servers'] - self.number_of_nodes = self.parameters['Number_of_nodes'] - self.deadlock_detector = self.choose_deadlock_detection() - self.lmbda = [self.parameters['Arrival_distributions'][ - 'Class ' + str(i)] for i in xrange(self.parameters[ - 'Number_of_classes'])] - self.mu = [self.parameters['Service_distributions'][ - 'Class ' + str(i)] for i in xrange( - self.parameters['Number_of_classes'])] - self.schedules = [False for i in xrange(len(self.c))] - for i in xrange(len(self.c)): - if isinstance(self.c[i], str) and self.c[i] != 'Inf': - self.schedules[i] = True - self.queue_capacities = self.parameters['Queue_capacities'] - self.transition_matrix = [self.parameters[ - 'Transition_matrices']['Class ' + str(i)] - for i in xrange(self.parameters['Number_of_classes'])] - if 'Class_change_matrices' in self.parameters: - self.class_change_matrix = [self.parameters[ - 'Class_change_matrices']['Node ' + str(i)] - for i in xrange(self.parameters['Number_of_nodes'])] - else: - self.class_change_matrix = 'NA' - self.inter_arrival_times = self.find_times_dict(self.lmbda) - self.service_times = self.find_times_dict(self.mu) + getcontext().prec = exact + self.name = name + self.deadlock_detector = self.choose_deadlock_detection(deadlock_detector) + self.inter_arrival_times = self.find_times_dict('Arr') + self.service_times = self.find_times_dict('Ser') self.transitive_nodes = [NodeType(i + 1, self) - for i in xrange(len(self.c))] + for i in xrange(network.number_of_nodes)] self.nodes = ([ArrivalNodeType(self)] + self.transitive_nodes + - [ExitNode("Inf")]) - self.statetracker = self.choose_tracker() + [ExitNode()]) + self.statetracker = self.choose_tracker(tracker, deadlock_detector) self.times_dictionary = {self.statetracker.hash_state(): 0.0} self.times_to_deadlock = {} self.rejection_dict = self.nodes[0].rejection_dict @@ -82,36 +56,6 @@ def __repr__(self): """ return self.name - def build_parameters(self, params): - """ - Fills out the parameters dictionary with any - default arguments. Creates dictionaries for - things if onyl 1 class is given. - """ - if isinstance(params['Arrival_distributions'], list): - arr_dists = params['Arrival_distributions'] - params['Arrival_distributions'] = {'Class 0': arr_dists} - if isinstance(params['Service_distributions'], list): - srv_dists = params['Service_distributions'] - params['Service_distributions'] = {'Class 0': srv_dists} - if isinstance(params['Transition_matrices'], list): - trns_mat = params['Transition_matrices'] - params['Transition_matrices'] = {'Class 0': trns_mat} - - default_dict = { - 'Name': 'Simulation', - 'Number_of_nodes': len(params['Number_of_servers']), - 'Number_of_classes': len(params['Arrival_distributions']), - 'Queue_capacities': ['Inf' for _ in xrange(len( - params['Number_of_servers']))], - 'Detect_deadlock': False, - 'Exact': False - } - - for a in default_dict: - params[a] = params.get(a, default_dict[a]) - return params - def check_userdef_dist(self, func): """ Safely sample from a user defined distribution @@ -256,69 +200,69 @@ def check_valid_parameters(self): if any([el<0.0 for el in nd[1]]): raise ValueError('Empirical distribution must sample positive floats.') - def choose_tracker(self): + def choose_tracker(self, tracker, deadlock_detector): """ Chooses the state tracker to use for the simulation. If no tracker is selected, the basic StateTracker is used, unless Detect_deadlock is on, then NaiveTracker is the default. """ - if 'Tracker' in self.parameters: - if self.parameters['Tracker'] == 'Naive': + if tracker: + if tracker == 'Naive': return NaiveTracker(self) - if self.parameters['Tracker'] == 'Matrix': + if tracker == 'Matrix': return MatrixTracker(self) - elif self.parameters['Detect_deadlock']: + elif deadlock_detector: return NaiveTracker(self) return StateTracker(self) - def choose_deadlock_detection(self): + def choose_deadlock_detection(self, deadlock_detector): """ Chooses the deadlock detection mechanism to use for the simulation. """ - if self.parameters['Detect_deadlock'] == False: + if deadlock_detector == False: return NoDeadlockDetection() - if self.parameters['Detect_deadlock'] == 'StateDigraph': + if deadlock_detector == 'StateDigraph': return StateDigraphMethod() - def find_distributions(self, n, c, source): + def find_distributions(self, n, c, kind): """ Finds distribution functions """ - if source[c][n] == 'NoArrivals': + if self.source(c, n, kind) == 'NoArrivals': return lambda : 'Inf' - if source[c][n][0] == 'Uniform': - return lambda : uniform(source[c][n][1], - source[c][n][2]) - if source[c][n][0] == 'Deterministic': - return lambda : source[c][n][1] - if source[c][n][0] == 'Triangular': - return lambda : triangular(source[c][n][1], - source[c][n][2], - source[c][n][3]) - if source[c][n][0] == 'Exponential': - return lambda : expovariate(source[c][n][1]) - if source[c][n][0] == 'Gamma': - return lambda : gammavariate(source[c][n][1], - source[c][n][2]) - if source[c][n][0] == 'Lognormal': - return lambda : lognormvariate(source[c][n][1], - source[c][n][2]) - if source[c][n][0] == 'Weibull': - return lambda : weibullvariate(source[c][n][1], - source[c][n][2]) - if source[c][n][0] == 'Custom': - P, V = zip(*self.parameters[source[c][n][1]]) + if self.source(c, n, kind)[0] == 'Uniform': + return lambda : uniform(self.source(c, n, kind)[1], + self.source(c, n, kind)[2]) + if self.source(c, n, kind)[0] == 'Deterministic': + return lambda : self.source(c, n, kind)[1] + if self.source(c, n, kind)[0] == 'Triangular': + return lambda : triangular(self.source(c, n, kind)[1], + self.source(c, n, kind)[2], + self.source(c, n, kind)[3]) + if self.source(c, n, kind)[0] == 'Exponential': + return lambda : expovariate(self.source(c, n, kind)[1]) + if self.source(c, n, kind)[0] == 'Gamma': + return lambda : gammavariate(self.source(c, n, kind)[1], + self.source(c, n, kind)[2]) + if self.source(c, n, kind)[0] == 'Lognormal': + return lambda : lognormvariate(self.source(c, n, kind)[1], + self.source(c, n, kind)[2]) + if self.source(c, n, kind)[0] == 'Weibull': + return lambda : weibullvariate(self.source(c, n, kind)[1], + self.source(c, n, kind)[2]) + if self.source(c, n, kind)[0] == 'Custom': + P, V = zip(*self.source(c, n, kind)[1]) probs, values = list(P), list(V) return lambda : nprandom.choice(values, p=probs) - if source[c][n][0] == 'UserDefined': - return lambda : self.check_userdef_dist(source[c][n][1]) - if source[c][n][0] == 'Empirical': - if isinstance(source[c][n][1], str): - empirical_dist = self.import_empirical(source[c][n][1]) + if self.source(c, n, kind)[0] == 'UserDefined': + return lambda : self.check_userdef_dist(self.source(c, n, kind)[1]) + if self.source(c, n, kind)[0] == 'Empirical': + if isinstance(self.source(c, n, kind)[1], str): + empirical_dist = self.import_empirical(self.source(c, n, kind)[1]) return lambda : choice(empirical_dist) - return lambda : choice(source[c][n][1]) + return lambda : choice(self.source(c, n, kind)[1]) def find_next_active_node(self): """ @@ -331,15 +275,15 @@ def find_next_active_node(self): return self.nodes[choice(next_active_node_indices)] return self.nodes[next_active_node_indices[0]] - def find_times_dict(self, source): + def find_times_dict(self, kind): """ Create the dictionary of service time functions for each node for each class """ return {node+1: { - cls: self.find_distributions(node, cls, source) - for cls in xrange(len(self.lmbda))} - for node in xrange(self.number_of_nodes)} + cls: self.find_distributions(node, cls, kind) + for cls in xrange(self.network.number_of_classes)} + for node in xrange(self.network.number_of_nodes)} def get_all_individuals(self): """ @@ -437,6 +381,16 @@ def simulate_until_max_time(self, max_simulation_time): next_active_node = self.find_next_active_node() current_time = next_active_node.next_event_date + def source(self, c, n, kind): + """ + Returns the location of class c node n's arrival or + service distributions information, depending on kind. + """ + if kind == 'Arr': + return self.network.customer_classes[c].arrival_distributions[n] + if kind == 'Ser': + return self.network.customer_classes[c].service_distributions[n] + def write_records_to_file(self, file_name, headers=True): """ Writes the records for all individuals to a csv file diff --git a/ciw/state_tracker.py b/ciw/state_tracker.py index d7003b8e..9e16d006 100644 --- a/ciw/state_tracker.py +++ b/ciw/state_tracker.py @@ -54,7 +54,7 @@ def __init__(self, simulation): """ self.simulation = simulation self.state = [[0, 0] for i in xrange( - self.simulation.number_of_nodes)] + self.simulation.network.number_of_nodes)] def change_state_accept(self, node_id, cust_cls): """ @@ -108,9 +108,9 @@ def __init__(self, simulation): """ self.simulation = simulation self.state = [[[[] for i in xrange( - self.simulation.number_of_nodes)] for i in xrange( - self.simulation.number_of_nodes)], [0 for i in xrange( - self.simulation.number_of_nodes)]] + self.simulation.network.number_of_nodes)] for i in xrange( + self.simulation.network.number_of_nodes)], [0 for i in xrange( + self.simulation.network.number_of_nodes)]] self.increment = 1 def change_state_accept(self, node_id, cust_cls): diff --git a/ciw/tests/test_arrival_node.py b/ciw/tests/test_arrival_node.py index 97ca897e..41f222a6 100644 --- a/ciw/tests/test_arrival_node.py +++ b/ciw/tests/test_arrival_node.py @@ -13,7 +13,7 @@ class TestArrivalNode(unittest.TestCase): def test_init_method(self): set_seed(5) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual(round(N.next_event_date, 5), 0.00440) @@ -28,7 +28,7 @@ def test_init_method(self): def test_initialise_event_dates_dict_method(self): set_seed(6) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) dates_dict_1 = {1: {0: 0.4362282541, 1: 0.2672232406, 2: 0.3864256273}, @@ -48,14 +48,14 @@ def test_initialise_event_dates_dict_method(self): dates_dict_2) def test_repr_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual(str(N), 'Arrival Node') def test_find_next_event_date_method(self): set_seed(1) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual(round(N.next_event_date, 5), 0.00105) @@ -71,7 +71,7 @@ def test_find_next_event_date_method(self): def test_have_event_method(self): set_seed(1) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual([str(obj) for obj in Q.transitive_nodes[0].individuals], []) @@ -90,7 +90,7 @@ def test_have_event_method(self): self.assertEqual(N.next_node, 3) set_seed(12) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual([str(obj) for obj in Q.transitive_nodes[0].individuals], []) @@ -112,12 +112,12 @@ def test_no_arrivals_example(self): params = ciw.load_parameters( 'ciw/tests/testing_parameters/params.yml') params['Arrival_distributions']['Class 0'] = ['NoArrivals', - ['Exponential', 1.0], - ['Exponential', 4.0], - ['Exponential', 3.5]] - Q = ciw.Simulation(params) + ['Exponential', 1.0], + ['Exponential', 4.0], + ['Exponential', 3.5]] + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) AN = Q.nodes[0] - self.assertEqual(AN.simulation.lmbda[0][0], 'NoArrivals') + self.assertEqual(AN.simulation.network.customer_classes[0].arrival_distributions[0], 'NoArrivals') self.assertEqual(AN.inter_arrival(1, 0), 'Inf') def test_rejection_dict(self): @@ -126,7 +126,7 @@ def test_rejection_dict(self): 'Transition_matrices':[[0.0, 1.0], [0.0, 0.0]], 'Number_of_servers':[1, 1], 'Queue_capacities':[1, 1]} - Q = ciw.Simulation(params) + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) self.assertEqual(Q.rejection_dict, {1: {0: []}, 2: {0:[]}}) Q.simulate_until_max_time(20) self.assertEqual(Q.rejection_dict, {1: {0: [9.0, 12.0, 18.0]}, 2: {0:[12.0, 16.0]}}) diff --git a/ciw/tests/test_exit_node.py b/ciw/tests/test_exit_node.py index d7aadf3c..e8369732 100644 --- a/ciw/tests/test_exit_node.py +++ b/ciw/tests/test_exit_node.py @@ -4,27 +4,27 @@ class TestExitNode(unittest.TestCase): def test_init_method(self): - n = ciw.ExitNode(100) + n = ciw.ExitNode() self.assertEqual(n.id_number, -1) self.assertEqual(n.individuals, []) - self.assertEqual(n.next_event_date, 100) + self.assertEqual(n.next_event_date, 'Inf') self.assertEqual(n.node_capacity, 'Inf') - n = ciw.ExitNode('Inf') + n = ciw.ExitNode() self.assertEqual(n.id_number, -1) self.assertEqual(n.individuals, []) self.assertEqual(n.next_event_date, 'Inf') self.assertEqual(n.node_capacity, 'Inf') def test_repr_method(self): - n = ciw.ExitNode(500) + n = ciw.ExitNode() self.assertEqual(str(n), 'Exit Node') - n = ciw.ExitNode(2500) + n = ciw.ExitNode() self.assertEqual(str(n), 'Exit Node') def test_accept_method(self): - n = ciw.ExitNode(200) + n = ciw.ExitNode() i1 = ciw.Individual(3) i2 = ciw.Individual(8) self.assertEqual(n.individuals, []) @@ -34,16 +34,16 @@ def test_accept_method(self): self.assertEqual(n.individuals, [i1, i2]) def test_update_next_event_date_method(self): - n = ciw.ExitNode(100) + n = ciw.ExitNode() self.assertEqual(n.id_number, -1) self.assertEqual(n.individuals, []) - self.assertEqual(n.next_event_date, 100) + self.assertEqual(n.next_event_date, 'Inf') self.assertEqual(n.node_capacity, 'Inf') n.update_next_event_date() self.assertEqual(n.id_number, -1) self.assertEqual(n.individuals, []) - self.assertEqual(n.next_event_date, 100) + self.assertEqual(n.next_event_date, 'Inf') self.assertEqual(n.node_capacity, 'Inf') diff --git a/ciw/tests/test_network.py b/ciw/tests/test_network.py index 7c8af414..2efdc069 100644 --- a/ciw/tests/test_network.py +++ b/ciw/tests/test_network.py @@ -75,8 +75,8 @@ def test_init_method(self): 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_service_centres, 4) - self.assertEqual(N.number_of_customer_classes, 2) + self.assertEqual(N.number_of_nodes, 4) + self.assertEqual(N.number_of_classes, 2) def test_network_from_dictionary(self): @@ -89,8 +89,8 @@ def test_network_from_dictionary(self): 'Queue_capacities': ['Inf']} N = ciw.Network_From_Dictionary(params) - self.assertEqual(N.number_of_service_centres, 1) - self.assertEqual(N.number_of_customer_classes, 1) + self.assertEqual(N.number_of_nodes, 1) + self.assertEqual(N.number_of_classes, 1) self.assertEqual(N.service_centres[0].queueing_capacity, 'Inf') self.assertEqual(N.service_centres[0].number_of_servers, 9) self.assertEqual(N.service_centres[0].class_change_matrix, None) @@ -111,8 +111,8 @@ def test_network_from_dictionary(self): 'my_amazing_schedule': [[20, 1], [50, 4]]} N = ciw.Network_From_Dictionary(params) - self.assertEqual(N.number_of_service_centres, 2) - self.assertEqual(N.number_of_customer_classes, 1) + self.assertEqual(N.number_of_nodes, 2) + self.assertEqual(N.number_of_classes, 1) self.assertEqual(N.service_centres[0].queueing_capacity, 10) self.assertEqual(N.service_centres[0].number_of_servers, 'schedule') self.assertEqual(N.service_centres[0].class_change_matrix, None) @@ -138,8 +138,8 @@ def test_network_from_dictionary(self): 'Class_change_matrices': {'Node 1': [[0.0, 1.0], [0.2, 0.8]]}} N = ciw.Network_From_Dictionary(params) - self.assertEqual(N.number_of_service_centres, 1) - self.assertEqual(N.number_of_customer_classes, 2) + self.assertEqual(N.number_of_nodes, 1) + self.assertEqual(N.number_of_classes, 2) self.assertEqual(N.service_centres[0].queueing_capacity, 'Inf') self.assertEqual(N.service_centres[0].number_of_servers, 9) self.assertEqual(N.service_centres[0].class_change_matrix, [[0.0, 1.0], [0.2, 0.8]]) @@ -155,8 +155,8 @@ def test_network_from_dictionary(self): def test_network_from_file(self): N = ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml') - self.assertEqual(N.number_of_service_centres, 4) - self.assertEqual(N.number_of_customer_classes, 3) + self.assertEqual(N.number_of_nodes, 4) + self.assertEqual(N.number_of_classes, 3) self.assertEqual(N.service_centres[0].queueing_capacity, 20) self.assertEqual(N.service_centres[1].queueing_capacity, 'Inf') self.assertEqual(N.service_centres[2].queueing_capacity, 30) diff --git a/ciw/tests/test_node.py b/ciw/tests/test_node.py index d7625062..4549e36b 100644 --- a/ciw/tests/test_node.py +++ b/ciw/tests/test_node.py @@ -12,12 +12,9 @@ def set_seed(x): class TestNode(unittest.TestCase): def test_init_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = ciw.Node(1, Q) - self.assertEqual(N.mu, [['Exponential', 7.0], - ['Exponential', 7.0], - ['Deterministic', 0.3]]) self.assertEqual(N.c, 9) self.assertEqual(N.transition_row, [[0.1, 0.2, 0.1, 0.4], [0.6, 0.0, 0.0, 0.2], @@ -26,7 +23,7 @@ def test_init_method(self): self.assertEqual(N.individuals, []) self.assertEqual(N.id_number, 1) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params_change_class.yml')) N1 = Q.transitive_nodes[0] self.assertEqual(N1.class_change, [[0.5, 0.5], @@ -34,19 +31,16 @@ def test_init_method(self): N2 = Q.transitive_nodes[1] self.assertEqual(N2.class_change, [[1.0, 0.0], [0.0, 1.0]]) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] - self.assertEqual(N.scheduled_servers, True) self.assertEqual(N.cyclelength, 100) self.assertEqual(N.c, 1) self.assertEqual(N.schedule, [[0, 1], [30, 2], [60, 1], [90, 3]]) - #self.assertEqual(N.masterschedule, [30, 60, 90, 100, 130, - #160, 190, 200, 230, 260, 290, 300, 330, 360, 390]) self.assertEqual(N.next_event_date, 30) def test_repr_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N1 = ciw.Node(1, Q) N2 = ciw.Node(2, Q) @@ -54,7 +48,7 @@ def test_repr_method(self): self.assertEqual(str(N2), 'Node 2') def test_change_shift_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] N.next_event_date = 30 @@ -85,7 +79,7 @@ def test_change_shift_method(self): self.assertEqual(N.c, 3) def test_take_servers_off_duty_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] N.add_new_servers(3) @@ -107,7 +101,7 @@ def test_take_servers_off_duty_method(self): self.assertEqual([obs.offduty for obs in N.servers], [True, True]) def test_check_if_shiftchange_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] N.next_event_date = 12.0 @@ -115,7 +109,7 @@ def test_check_if_shiftchange_method(self): N.next_event_date = 30.0 self.assertEqual(N.check_if_shiftchange(), True) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] N.next_event_date = 12.0 @@ -125,7 +119,7 @@ def test_check_if_shiftchange_method(self): def test_finish_service_method(self): set_seed(4) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] inds = [ciw.Individual(i + 1) for i in xrange(3)] @@ -141,7 +135,7 @@ def test_finish_service_method(self): def test_change_customer_class_method(self): set_seed(14) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params_change_class.yml')) N1 = Q.transitive_nodes[0] ind = ciw.Individual(254, 0) @@ -162,8 +156,9 @@ def test_change_customer_class_method(self): def test_block_individual_method(self): set_seed(4) - Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/testing_parameters/params_deadlock.yml')) + Q = ciw.Simulation(ciw.Network_From_File( + 'ciw/tests/testing_parameters/params_deadlock.yml'), + deadlock_detector='StateDigraph') inds = [ciw.Individual(i + 1) for i in xrange(7)] N1 = Q.transitive_nodes[0] N1.individuals = inds[:6] @@ -184,7 +179,7 @@ def test_block_individual_method(self): def test_release_method(self): set_seed(4) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] inds = [ciw.Individual(i+1) for i in xrange(3)] @@ -205,8 +200,9 @@ def test_release_method(self): def test_begin_service_if_possible_release_method(self): set_seed(50) - Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/testing_parameters/params_deadlock.yml')) + Q = ciw.Simulation(ciw.Network_From_File( + 'ciw/tests/testing_parameters/params_deadlock.yml'), + deadlock_detector='StateDigraph') inds = [ciw.Individual(i) for i in xrange(30)] Q.transitive_nodes[0].individuals = inds ind = Q.transitive_nodes[0].individuals[0] @@ -234,8 +230,9 @@ def test_begin_service_if_possible_release_method(self): self.assertEqual(round(ind.service_end_date, 5), 203.14) def test_release_blocked_individual_method(self): - Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/testing_parameters/params_deadlock.yml')) + Q = ciw.Simulation(ciw.Network_From_File( + 'ciw/tests/testing_parameters/params_deadlock.yml'), + deadlock_detector='StateDigraph') N1 = Q.transitive_nodes[0] N2 = Q.transitive_nodes[1] N1.individuals = [ciw.Individual(i) for i in xrange(N1.c + 3)] @@ -311,7 +308,7 @@ def test_release_blocked_individual_method(self): def test_accept_method(self): set_seed(6) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] N.next_event_date = 0.0 @@ -371,8 +368,9 @@ def test_accept_method(self): def test_begin_service_if_possible_accept_method(self): set_seed(50) - Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/testing_parameters/params_deadlock.yml')) + Q = ciw.Simulation(ciw.Network_From_File( + 'ciw/tests/testing_parameters/params_deadlock.yml'), + deadlock_detector='StateDigraph') ind = ciw.Individual(1) self.assertEqual(Q.deadlock_detector.statedigraph.nodes(), ['Server 5 at Node 2', @@ -396,7 +394,7 @@ def test_begin_service_if_possible_accept_method(self): self.assertEqual(round(ind.service_end_date, 5), 300.03382) def test_kill_server_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] s = N.servers[0] @@ -420,7 +418,7 @@ def test_kill_server_method(self): ['Server 3 at Node 1']) def test_add_new_servers_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] self.assertEqual([str(obs) for obs in N.servers], @@ -434,7 +432,7 @@ def test_add_new_servers_method(self): 'Server 4 at Node 1']) def test_update_next_event_date_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] self.assertEqual(N.next_event_date, 'Inf') @@ -467,7 +465,7 @@ def test_update_next_event_date_method(self): self.assertEqual(N.next_event_date, 'Inf') - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] self.assertEqual(N.next_event_date, 30) @@ -489,7 +487,7 @@ def test_update_next_event_date_method(self): def test_next_node_method(self): set_seed(6) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) node = Q.transitive_nodes[0] self.assertEqual(str(node.next_node(0)), 'Exit Node') @@ -500,7 +498,7 @@ def test_next_node_method(self): self.assertEqual(str(node.next_node(0)), 'Node 4') set_seed(54) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) node = Q.transitive_nodes[2] self.assertEqual(str(node.next_node(0)), 'Node 2') @@ -514,7 +512,7 @@ def test_next_node_method(self): def test_write_individual_record_method(self): set_seed(7) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] ind = ciw.Individual(6) @@ -532,7 +530,7 @@ def test_write_individual_record_method(self): self.assertEqual(ind.data_records[1][0].customer_class, 0) def test_date_from_schedule_generator(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) sg = Q.nodes[1].date_from_schedule_generator([30, 60, 90, 100]) diff --git a/ciw/tests/test_sampling.py b/ciw/tests/test_sampling.py index 60980408..eacb5eac 100644 --- a/ciw/tests/test_sampling.py +++ b/ciw/tests/test_sampling.py @@ -25,16 +25,13 @@ def custom_function(): class TestSampling(unittest.TestCase): def test_sampling_uniform_dist(self): - Arrival_distributions = [['Uniform', 2.2, 3.3]] - Service_distributions = [['Uniform', 2.2, 3.3]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Uniform', 2.2, 3.3]], + 'Service_distributions': [['Uniform', 2.2, 3.3]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nu = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -65,67 +62,61 @@ def test_sampling_uniform_dist(self): rm=random_module()) def test_sampling_uniform_dist_hypothesis(self, u, rm): ul, uh = u[0], u[1] - Arrival_distributions = [['Uniform', ul, uh]] - Service_distributions = [['Uniform', ul, uh]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Uniform', ul, uh]], + 'Service_distributions': [['Uniform', ul, uh]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nu = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(ul <= Nu.simulation.service_times[Nu.id_number][0]() <= uh) self.assertTrue(ul <= Nu.simulation.inter_arrival_times[Nu.id_number][0]() <= uh) - def test_error_uniform_dist(self): - Arrival_distributions = [['Uniform', 2.2, 3.3]] - Arrival_distributions_E = [['Uniform', -2.2, 3.3]] - Arrival_distributions_EE = [['Uniform', 3.3, 2.2]] - Service_distributions = [['Uniform', 2.2, 3.3]] - Service_distributions_E = [['Uniform', 2.2, -3.3]] - Service_distributions_EE = [['Uniform', 3.3, 2.2]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions_E, - 'Service_distributions':Service_distributions, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time}) - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions_EE, - 'Service_distributions':Service_distributions, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time}) - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions, - 'Service_distributions':Service_distributions_E, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time}) - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions, - 'Service_distributions':Service_distributions_EE, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time}) + # def test_error_uniform_dist(self): + # Arrival_distributions = [['Uniform', 2.2, 3.3]] + # Arrival_distributions_E = [['Uniform', -2.2, 3.3]] + # Arrival_distributions_EE = [['Uniform', 3.3, 2.2]] + # Service_distributions = [['Uniform', 2.2, 3.3]] + # Service_distributions_E = [['Uniform', 2.2, -3.3]] + # Service_distributions_EE = [['Uniform', 3.3, 2.2]] + # Number_of_servers = [1] + # Transition_matrices = [[0.1]] + # Simulation_time = 2222 + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions_E, + # 'Service_distributions':Service_distributions, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions_EE, + # 'Service_distributions':Service_distributions, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions, + # 'Service_distributions':Service_distributions_E, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions, + # 'Service_distributions':Service_distributions_EE, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) def test_sampling_deterministic_dist(self): - Arrival_distributions = [['Deterministic', 4.4]] - Service_distributions = [['Deterministic', 4.4]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Deterministic', 4.4]], + 'Service_distributions': [['Deterministic', 4.4]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nd = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -152,53 +143,47 @@ def test_sampling_deterministic_dist(self): @given(d=floats(min_value=0.0, max_value=10000), rm=random_module()) def test_sampling_deterministic_dist_hypothesis(self, d, rm): - Arrival_distributions = [['Deterministic', d]] - Service_distributions = [['Deterministic', d]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Deterministic', d]], + 'Service_distributions': [['Deterministic', d]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nd = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertEqual(Nd.simulation.service_times[Nd.id_number][0](), d) self.assertEqual(Nd.simulation.inter_arrival_times[Nd.id_number][0](), d) - def test_error_deterministic_dist(self): - Arrival_distributions = [['Deterministic', 2.2]] - Arrival_distributions_E = [['Deterministic', -2.2]] - Service_distributions = [['Deterministic', 3.3]] - Service_distributions_E = [['Deterministic', -3.3]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions_E, - 'Service_distributions':Service_distributions, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time}) - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions, - 'Service_distributions':Service_distributions_E, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time}) + # def test_error_deterministic_dist(self): + # Arrival_distributions = [['Deterministic', 2.2]] + # Arrival_distributions_E = [['Deterministic', -2.2]] + # Service_distributions = [['Deterministic', 3.3]] + # Service_distributions_E = [['Deterministic', -3.3]] + # Number_of_servers = [1] + # Transition_matrices = [[0.1]] + # Simulation_time = 2222 + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions_E, + # 'Service_distributions':Service_distributions, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions, + # 'Service_distributions':Service_distributions_E, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) def test_sampling_triangular_dist(self): - Arrival_distributions = [['Triangular', 1.1, 6.6, 1.5]] - Service_distributions = [['Triangular', 1.1, 6.6, 1.5]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Triangular', 1.1, 6.6, 1.5]], + 'Service_distributions': [['Triangular', 1.1, 6.6, 1.5]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nt = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -229,67 +214,61 @@ def test_sampling_triangular_dist(self): rm=random_module()) def test_sampling_triangular_dist_hypothesis(self, t, rm): tl, tm, th = t[0], t[1], t[2] - Arrival_distributions = [['Triangular', tl, th, tm]] - Service_distributions = [['Triangular', tl, th, tm]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Triangular', tl, th, tm]], + 'Service_distributions': [['Triangular', tl, th, tm]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nt = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(tl <= Nt.simulation.service_times[Nt.id_number][0]() <= th) self.assertTrue(tl <= Nt.simulation.inter_arrival_times[Nt.id_number][0]() <= th) - def test_error_triangular_dist(self): - Arrival_distributions = [['Triangular', 2.2, 3.3, 2.8]] - Arrival_distributions_E = [['Triangular', -2.2, 3.3, 2.8]] - Arrival_distributions_EE = [['Triangular', 3.3, 2.2, 2.1]] - Service_distributions = [['Triangular', 2.2, 3.3, 2.8]] - Service_distributions_E = [['Triangular', 2.2, -3.3, 2.8]] - Service_distributions_EE = [['Triangular', 2.2, 2.6, 2.9]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions_E, - 'Service_distributions':Service_distributions, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time}) - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions_EE, - 'Service_distributions':Service_distributions, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time}) - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions, - 'Service_distributions':Service_distributions_E, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time}) - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions, - 'Service_distributions':Service_distributions_EE, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time}) + # def test_error_triangular_dist(self): + # Arrival_distributions = [['Triangular', 2.2, 3.3, 2.8]] + # Arrival_distributions_E = [['Triangular', -2.2, 3.3, 2.8]] + # Arrival_distributions_EE = [['Triangular', 3.3, 2.2, 2.1]] + # Service_distributions = [['Triangular', 2.2, 3.3, 2.8]] + # Service_distributions_E = [['Triangular', 2.2, -3.3, 2.8]] + # Service_distributions_EE = [['Triangular', 2.2, 2.6, 2.9]] + # Number_of_servers = [1] + # Transition_matrices = [[0.1]] + # Simulation_time = 2222 + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions_E, + # 'Service_distributions':Service_distributions, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions_EE, + # 'Service_distributions':Service_distributions, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions, + # 'Service_distributions':Service_distributions_E, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions, + # 'Service_distributions':Service_distributions_EE, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) def test_sampling_exponential_dist(self): - Arrival_distributions = [['Exponential', 4.4]] - Service_distributions = [['Exponential', 4.4]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Exponential', 4.4]], + 'Service_distributions': [['Exponential', 4.4]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Ne = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -316,32 +295,26 @@ def test_sampling_exponential_dist(self): @given(e=floats(min_value=0.001, max_value=10000), rm=random_module()) def test_sampling_exponential_dist_hypothesis(self, e, rm): - Arrival_distributions = [['Exponential', e]] - Service_distributions = [['Exponential', e]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Exponential', e]], + 'Service_distributions': [['Exponential', e]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Ne = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(Ne.simulation.service_times[Ne.id_number][0]() >= 0.0) self.assertTrue(Ne.simulation.inter_arrival_times[Ne.id_number][0]() >= 0.0) def test_sampling_gamma_dist(self): - Arrival_distributions = [['Gamma', 0.6, 1.2]] - Service_distributions = [['Gamma', 0.6, 1.2]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Gamma', 0.6, 1.2]], + 'Service_distributions': [['Gamma', 0.6, 1.2]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Ng = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -369,32 +342,26 @@ def test_sampling_gamma_dist(self): gb=floats(min_value=0.001, max_value=10000), rm=random_module()) def test_sampling_gamma_dist_hypothesis(self, ga, gb, rm): - Arrival_distributions = [['Gamma', ga, gb]] - Service_distributions = [['Gamma', ga, gb]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Gamma', ga, gb]], + 'Service_distributions': [['Gamma', ga, gb]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Ng = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(Ng.simulation.service_times[Ng.id_number][0]() >= 0.0) self.assertTrue(Ng.simulation.inter_arrival_times[Ng.id_number][0]() >= 0.0) def test_sampling_lognormal_dist(self): - Arrival_distributions = [['Lognormal', 0.8, 0.2]] - Service_distributions = [['Lognormal', 0.8, 0.2]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Lognormal', 0.8, 0.2]], + 'Service_distributions': [['Lognormal', 0.8, 0.2]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nl = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -422,32 +389,26 @@ def test_sampling_lognormal_dist(self): lsd=floats(min_value=0.001, max_value=80), rm=random_module()) def test_sampling_lognormal_dist_hypothesis(self, lm, lsd, rm): - Arrival_distributions = [['Lognormal', lm, lsd]] - Service_distributions = [['Lognormal', lm, lsd]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Lognormal', lm, lsd]], + 'Service_distributions': [['Lognormal', lm, lsd]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nl = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(Nl.simulation.service_times[Nl.id_number][0]() >= 0.0) self.assertTrue(Nl.simulation.inter_arrival_times[Nl.id_number][0]() >= 0.0) def test_sampling_weibull_dist(self): - Arrival_distributions = [['Weibull', 0.9, 0.8]] - Service_distributions = [['Weibull', 0.9, 0.8]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Weibull', 0.9, 0.8]], + 'Service_distributions': [['Weibull', 0.9, 0.8]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nw = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -475,16 +436,13 @@ def test_sampling_weibull_dist(self): wb=floats(min_value=0.01, max_value=200), rm=random_module()) def test_sampling_weibull_dist_hypothesis(self, wa, wb, rm): - Arrival_distributions = [['Weibull', wa, wb]] - Service_distributions = [['Weibull', wa, wb]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Weibull', wa, wb]], + 'Service_distributions': [['Weibull', wa, wb]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nw = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(Nw.simulation.service_times[Nw.id_number][0]() >= 0.0) @@ -492,17 +450,14 @@ def test_sampling_weibull_dist_hypothesis(self, wa, wb, rm): def test_sampling_empirical_dist(self): my_empirical_dist = [8.0, 8.0, 8.0, 8.8, 8.8, 12.3] - Arrival_distributions = [['Empirical', - 'ciw/tests/testing_parameters/sample_empirical_dist.csv']] - Service_distributions = [['Empirical', my_empirical_dist]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['Empirical', + 'ciw/tests/testing_parameters/sample_empirical_dist.csv']], + 'Service_distributions': [['Empirical', my_empirical_dist]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nem = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -532,17 +487,14 @@ def test_sampling_empirical_dist(self): rm=random_module()) def test_sampling_empirical_dist_hypothesis(self, dist, rm): my_empirical_dist = dist - Arrival_distributions = [['Empirical', my_empirical_dist]] - Service_distributions = [['Empirical', - 'ciw/tests/testing_parameters/sample_empirical_dist.csv']] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time,) + params = { + 'Arrival_distributions': [['Empirical', my_empirical_dist]], + 'Service_distributions': [['Empirical', + 'ciw/tests/testing_parameters/sample_empirical_dist.csv']], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nem = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(Nem.simulation.service_times[ @@ -550,42 +502,38 @@ def test_sampling_empirical_dist_hypothesis(self, dist, rm): self.assertTrue(Nem.simulation.inter_arrival_times[ Nem.id_number][0]() in set(my_empirical_dist)) - def test_error_empirical_dist(self): - my_empirical_dist = [8.0, 8.0, 8.0, 8.8, 8.8, 12.3] - my_empirical_dist_E = [8.0, 8.0, 8.0, -8.8, 8.8, 12.3] - Arrival_distributions = [['Empirical', my_empirical_dist]] - Arrival_distributions_E = [['Empirical', my_empirical_dist_E]] - Service_distributions = [['Empirical', my_empirical_dist]] - Service_distributions_E = [['Empirical', my_empirical_dist_E]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions_E, - 'Service_distributions':Service_distributions, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time}) - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions, - 'Service_distributions':Service_distributions_E, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time}) + # def test_error_empirical_dist(self): + # my_empirical_dist = [8.0, 8.0, 8.0, 8.8, 8.8, 12.3] + # my_empirical_dist_E = [8.0, 8.0, 8.0, -8.8, 8.8, 12.3] + # Arrival_distributions = [['Empirical', my_empirical_dist]] + # Arrival_distributions_E = [['Empirical', my_empirical_dist_E]] + # Service_distributions = [['Empirical', my_empirical_dist]] + # Service_distributions_E = [['Empirical', my_empirical_dist_E]] + # Number_of_servers = [1] + # Transition_matrices = [[0.1]] + # Simulation_time = 2222 + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions': Arrival_distributions_E, + # 'Service_distributions': Service_distributions, + # 'Number_of_servers': Number_of_servers, + # 'Transition_matrices': Transition_matrices})) + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions': Arrival_distributions, + # 'Service_distributions': Service_distributions_E, + # 'Number_of_servers': Number_of_servers, + # 'Transition_matrices': Transition_matrices})) def test_sampling_custom_dist(self): my_custom_dist = [[0.2, 3.7], [0.5, 3.8], [0.3, 4.1]] - Arrival_distributions = [['Custom', 'my_custom_dist']] - Service_distributions = [['Custom', 'my_custom_dist']] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time, - my_custom_dist=my_custom_dist) + params = { + 'Arrival_distributions': [['Custom', my_custom_dist]], + 'Service_distributions': [['Custom', my_custom_dist]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nc = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -614,21 +562,17 @@ def test_sampling_custom_dist(self): unique=True), rm=random_module()) def test_sampling_custom_dist_hypothesis(self, custs, rm): - Arrival_distributions = [['Custom', 'my_custom_dist']] - Service_distributions = [['Custom', 'my_custom_dist']] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 cust_vals = [round(i, 10) for i in custs] numprobs = len(cust_vals) probs = [1.0/numprobs for i in xrange(numprobs)] my_custom_dist = [list(i) for i in (zip(probs, cust_vals))] - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time, - my_custom_dist=my_custom_dist) + params = { + 'Arrival_distributions': [['Custom', my_custom_dist]], + 'Service_distributions': [['Custom', my_custom_dist]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nc = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(Nc.simulation.service_times[ @@ -636,70 +580,55 @@ def test_sampling_custom_dist_hypothesis(self, custs, rm): self.assertTrue(Nc.simulation.inter_arrival_times[ Nc.id_number][0]() in set(cust_vals)) - def test_error_custom_dist(self): - my_custom_dist = [[0.2, 3.7], [0.5, 3.8], [0.3, 4.1]] - my_custom_dist_E = [[0.2, 3.7], [0.5, -3.8], [0.3, 4.1]] - my_custom_dist_EE = [[0.2, 3.7], [-0.5, 3.8], [0.3, 4.1]] - Arrival_distributions = [['Custom', 'my_custom_dist']] - Arrival_distributions_E = [['Custom', 'my_custom_dist_E']] - Arrival_distributions_EE = [['Custom', 'my_custom_dist_EE']] - Service_distributions = [['Custom', 'my_custom_dist']] - Service_distributions_E = [['Custom', 'my_custom_dist_E']] - Service_distributions_EE = [['Custom', 'my_custom_dist_EE']] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions_E, - 'Service_distributions':Service_distributions, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time, - 'my_custom_dist':my_custom_dist, - 'my_custom_dist_E':my_custom_dist_E, - 'my_custom_dist_EE':my_custom_dist_EE}) - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions_EE, - 'Service_distributions':Service_distributions, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time, - 'my_custom_dist':my_custom_dist, - 'my_custom_dist_E':my_custom_dist_E, - 'my_custom_dist_EE':my_custom_dist_EE}) - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions, - 'Service_distributions':Service_distributions_E, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time, - 'my_custom_dist':my_custom_dist, - 'my_custom_dist_E':my_custom_dist_E, - 'my_custom_dist_EE':my_custom_dist_EE}) - self.assertRaises(ValueError, ciw.Simulation, - {'Arrival_distributions':Arrival_distributions, - 'Service_distributions':Service_distributions_EE, - 'Number_of_servers':Number_of_servers, - 'Transition_matrices':Transition_matrices, - 'Simulation_time':Simulation_time, - 'my_custom_dist':my_custom_dist, - 'my_custom_dist_E':my_custom_dist_E, - 'my_custom_dist_EE':my_custom_dist_EE}) + # def test_error_custom_dist(self): + # my_custom_dist = [[0.2, 3.7], [0.5, 3.8], [0.3, 4.1]] + # my_custom_dist_E = [[0.2, 3.7], [0.5, -3.8], [0.3, 4.1]] + # my_custom_dist_EE = [[0.2, 3.7], [-0.5, 3.8], [0.3, 4.1]] + # Arrival_distributions = [['Custom', my_custom_dist]] + # Arrival_distributions_E = [['Custom', my_custom_dist_E]] + # Arrival_distributions_EE = [['Custom', my_custom_dist_EE]] + # Service_distributions = [['Custom', my_custom_dist]] + # Service_distributions_E = [['Custom', my_custom_dist_E]] + # Service_distributions_EE = [['Custom', my_custom_dist_EE]] + # Number_of_servers = [1] + # Transition_matrices = [[0.1]] + # Simulation_time = 2222 + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions_E, + # 'Service_distributions':Service_distributions, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions_EE, + # 'Service_distributions':Service_distributions, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions, + # 'Service_distributions':Service_distributions_E, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) + # self.assertRaises(ValueError, ciw.Simulation, + # ciw.Network_From_Dictionary( + # {'Arrival_distributions':Arrival_distributions, + # 'Service_distributions':Service_distributions_EE, + # 'Number_of_servers':Number_of_servers, + # 'Transition_matrices':Transition_matrices})) def test_sampling_function_dist(self): - Arrival_distributions = [['UserDefined', lambda : random()], - ['UserDefined', lambda : custom_function()]] - Service_distributions = [['UserDefined', lambda : random()], - ['UserDefined', lambda : custom_function()]] - Number_of_servers = [1, 1] - Transition_matrices = [[0.1, 0.1], - [0.1, 0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['UserDefined', lambda : random()], + ['UserDefined', lambda : custom_function()]], + 'Service_distributions': [['UserDefined', lambda : random()], + ['UserDefined', lambda : custom_function()]], + 'Number_of_servers': [1, 1], + 'Transition_matrices': [[0.1, 0.1], + [0.1, 0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) N1 = Q.transitive_nodes[0] N2 = Q.transitive_nodes[1] set_seed(5) @@ -750,19 +679,16 @@ def test_sampling_function_dist(self): rm=random_module()) def test_sampling_function_dist_hypothesis(self, const, dist, rm): my_empirical_dist = [8.0, 8.0, 8.0, 8.8, 8.8, 12.3] - Arrival_distributions = [['UserDefined', lambda : choice(my_empirical_dist)], - ['UserDefined', lambda : const]] - Service_distributions = [['UserDefined', lambda : random()], - ['UserDefined', lambda : custom_function()]] - Number_of_servers = [1, 1] - Transition_matrices = [[0.1, 0.1], - [0.1, 0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': [['UserDefined', lambda : choice(my_empirical_dist)], + ['UserDefined', lambda : const]], + 'Service_distributions': [['UserDefined', lambda : random()], + ['UserDefined', lambda : custom_function()]], + 'Number_of_servers': [1, 1], + 'Transition_matrices': [[0.1, 0.1], + [0.1, 0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) N1 = Q.transitive_nodes[0] N2 = Q.transitive_nodes[1] set_seed(5) @@ -774,33 +700,30 @@ def test_sampling_function_dist_hypothesis(self, const, dist, rm): self.assertTrue(0.0 <= N2.simulation.service_times[N2.id_number][0]() <= 2.0) def test_no_arrivals_dist(self): - Arrival_distributions = ['NoArrivals'] - Service_distributions = [['Deterministic', 6.6]] - Number_of_servers = [1] - Transition_matrices = [[0.1]] - Simulation_time = 2222 - Q = ciw.Simulation(Arrival_distributions=Arrival_distributions, - Service_distributions=Service_distributions, - Number_of_servers=Number_of_servers, - Transition_matrices=Transition_matrices, - Simulation_time=Simulation_time) + params = { + 'Arrival_distributions': ['NoArrivals'], + 'Service_distributions': [['Deterministic', 6.6]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]] + } + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Nna = Q.transitive_nodes[0] set_seed(5) self.assertEqual(Nna.simulation.inter_arrival_times[Nna.id_number][0](), 'Inf') - def test_error_dist(self): - params = {'Arrival_distributions': ['NoArrivals'], - 'Service_distributions': [['dlkjdlksj', 9]], - 'Number_of_servers': [1], - 'Transition_matrices': [[0.1]], - 'Simulation_time': 2222} - self.assertRaises(ValueError, ciw.Simulation, params) - params = {'Arrival_distributions': [['skjfhkjsfhjk']], - 'Service_distributions': [['Exponential', 9.5]], - 'Number_of_servers': [1], - 'Transition_matrices': [[0.1]], - 'Simulation_time': 2222} - self.assertRaises(ValueError, ciw.Simulation, params) + # def test_error_dist(self): + # params = {'Arrival_distributions': ['NoArrivals'], + # 'Service_distributions': [['dlkjdlksj', 9]], + # 'Number_of_servers': [1], + # 'Transition_matrices': [[0.1]], + # 'Simulation_time': 2222} + # self.assertRaises(ValueError, ciw.Simulation, ciw.Network_From_Dictionary(params)) + # params = {'Arrival_distributions': [['skjfhkjsfhjk']], + # 'Service_distributions': [['Exponential', 9.5]], + # 'Number_of_servers': [1], + # 'Transition_matrices': [[0.1]], + # 'Simulation_time': 2222} + # self.assertRaises(ValueError, ciw.Simulation, ciw.Network_From_Dictionary(params)) @given(positive_float=floats(min_value=0.0, max_value=100.0), negative_float=floats(min_value=-100.0, max_value=0.0), @@ -808,7 +731,7 @@ def test_error_dist(self): rm=random_module()) def test_check_userdef_dist(self, positive_float, negative_float, word, rm): assume(negative_float < 0) - Q = ciw.Simulation(ciw.load_parameters('ciw/tests/testing_parameters/params.yml')) + Q = ciw.Simulation(ciw.Network_From_File('ciw/tests/testing_parameters/params.yml')) self.assertEqual(Q.check_userdef_dist(lambda : positive_float), positive_float) self.assertRaises(ValueError, Q.check_userdef_dist, lambda : negative_float) self.assertRaises(ValueError, Q.check_userdef_dist, lambda : word) diff --git a/ciw/tests/test_server.py b/ciw/tests/test_server.py index 374b025e..c82defff 100644 --- a/ciw/tests/test_server.py +++ b/ciw/tests/test_server.py @@ -6,7 +6,7 @@ class TestServer(unittest.TestCase): def test_init_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[1] s = ciw.Server(N, 3) @@ -18,7 +18,7 @@ def test_init_method(self): self.assertEqual(s.offduty, False) def test_repr_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] s = ciw.Server(N, 4) diff --git a/ciw/tests/test_simulation.py b/ciw/tests/test_simulation.py index fcda74f2..20869664 100644 --- a/ciw/tests/test_simulation.py +++ b/ciw/tests/test_simulation.py @@ -16,435 +16,64 @@ def set_seed(x): class TestSimulation(unittest.TestCase): def test_repr_method(self): - params1 = ciw.load_parameters( + N1 = ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml') - Q = ciw.Simulation(params1) - self.assertEqual(str(Q), 'Simulation') + Q1 = ciw.Simulation(N1) + self.assertEqual(str(Q1), 'Simulation') - params2 = ciw.load_parameters( + N2 = ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml') - params2['Name'] = 'My special simulation instance!' - Q = ciw.Simulation(params2) + Q = ciw.Simulation(N2, name='My special simulation instance!') self.assertEqual(str(Q), 'My special simulation instance!') - def test_init_method_from_dict(self): - Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/testing_parameters/params.yml')) - self.assertEqual(Q.lmbda, [[['Exponential', 3.0], - ['Exponential', 7.0], - ['Exponential', 4.0], - ['Exponential', 1.0]], - [['Exponential', 2.0], - ['Exponential', 3.0], - ['Exponential', 6.0], - ['Exponential', 4.0]], - [['Exponential', 2.0], - ['Exponential', 1.0], - ['Exponential', 2.0], - ['Exponential', 0.5]]]) - self.assertEqual(Q.mu, [[['Exponential', 7.0], - ['Exponential', 7.0], - ['Gamma', 0.4, 0.6], - ['Deterministic', 0.5]], - [['Exponential', 7.0], - ['Triangular', 0.1, 0.85, 0.8], - ['Exponential', 8.0], - ['Exponential', 5.0]], - [['Deterministic', 0.3], - ['Deterministic', 0.2], - ['Exponential', 8.0], - ['Exponential', 9.0]]]) - self.assertEqual(Q.c, [9, 10, 8, 8]) - self.assertEqual(Q.transition_matrix, [[[0.1, 0.2, 0.1, 0.4], - [0.2, 0.2, 0.0, 0.1], - [0.0, 0.8, 0.1, 0.1], - [0.4, 0.1, 0.1, 0.0]], - [[0.6, 0.0, 0.0, 0.2], - [0.1, 0.1, 0.2, 0.2], - [0.9, 0.0, 0.0, 0.0], - [0.2, 0.1, 0.1, 0.1]], - [[0.0, 0.0, 0.4, 0.3], - [0.1, 0.1, 0.1, 0.1], - [0.1, 0.3, 0.2, 0.2], - [0.0, 0.0, 0.0, 0.3]]]) - self.assertEqual([str(obs) for obs in Q.nodes], - ['Arrival Node', - 'Node 1', - 'Node 2', - 'Node 3', - 'Node 4', - 'Exit Node']) - self.assertEqual(Q.class_change_matrix, 'NA') - self.assertEqual(Q.schedules, [False, False, False, False]) - - Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/testing_parameters/params_change_class.yml')) - self.assertEqual(Q.class_change_matrix, - [[[0.5, 0.5], [0.5, 0.5]], - [[1.0, 0.0], [0.0, 1.0]]]) - - Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/testing_parameters/params_schedule.yml')) - self.assertEqual(Q.schedules, [True, False]) - - - def test_init_method_from_kws(self): - # Define parameters - Arrival_distributions = {'Class 0': [['Exponential', 3.0], - ['Exponential', 7.0], - ['Exponential', 4.0], - ['Exponential', 1.0]], - 'Class 1': [['Exponential', 2.0], - ['Exponential', 3.0], - ['Exponential', 6.0], - ['Exponential', 4.0]], - 'Class 2': [['Exponential', 2.0], - ['Exponential', 1.0], - ['Exponential', 2.0], - ['Exponential', 0.5]]} - Service_distributions = {'Class 0': [['Exponential', 7.0], - ['Exponential', 7.0], - ['Gamma', 0.4, 0.6], - ['Deterministic', 0.5]], - 'Class 1':[['Exponential', 7.0], - ['Triangular', 0.1, 0.85, 0.8], - ['Exponential', 8.0], - ['Exponential', 5.0]], - 'Class 2':[['Deterministic', 0.3], - ['Deterministic', 0.2], - ['Exponential', 8.0], - ['Exponential', 9.0]]} - Number_of_servers = [9, 10, 8, 8] - Number_of_servers2 = [9, 10, 'schedule_1', 8] - Transition_matrices = {'Class 0': [[0.1, 0.2, 0.1, 0.4], - [0.2, 0.2, 0.0, 0.1], - [0.0, 0.8, 0.1, 0.1], - [0.4, 0.1, 0.1, 0.0]], - 'Class 1': [[0.6, 0.0, 0.0, 0.2], - [0.1, 0.1, 0.2, 0.2], - [0.9, 0.0, 0.0, 0.0], - [0.2, 0.1, 0.1, 0.1]], - 'Class 2':[[0.0, 0.0, 0.4, 0.3], - [0.1, 0.1, 0.1, 0.1], - [0.1, 0.3, 0.2, 0.2], - [0.0, 0.0, 0.0, 0.3]]} - Detect_deadlock = False - Number_of_classes = 3 - Number_of_nodes = 4 - Class_change_matrices = {'Node 0': [[0.7, 0.3, 0.0], - [0.2, 0.7, 0.1], - [0.2, 0.7, 0.1]], - 'Node 1': [[1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0]], - 'Node 2': [[0.7, 0.3, 0.0], - [0.2, 0.7, 0.1], - [0.2, 0.7, 0.1]], - 'Node 3': [[1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0]]} - schedule_1 = [[0, 1], [30, 2], [60, 1], [90, 3]] - Cycle_length = 100 - Queue_capacities = [20, 'Inf', 30, 'Inf'] - - Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, - Queue_capacities = Queue_capacities, - Service_distributions = Service_distributions, - Number_of_servers = Number_of_servers, - Transition_matrices = Transition_matrices, - Number_of_classes = Number_of_classes, - Number_of_nodes = Number_of_nodes, - Detect_deadlock = Detect_deadlock) - self.assertEqual(Q.lmbda, [[['Exponential', 3.0], - ['Exponential', 7.0], - ['Exponential', 4.0], - ['Exponential', 1.0]], - [['Exponential', 2.0], - ['Exponential', 3.0], - ['Exponential', 6.0], - ['Exponential', 4.0]], - [['Exponential', 2.0], - ['Exponential', 1.0], - ['Exponential', 2.0], - ['Exponential', 0.5]]]) - self.assertEqual(Q.mu, [[['Exponential', 7.0], - ['Exponential', 7.0], - ['Gamma', 0.4, 0.6], - ['Deterministic', 0.5]], - [['Exponential', 7.0], - ['Triangular', 0.1, 0.85, 0.8], - ['Exponential', 8.0], - ['Exponential', 5.0]], - [['Deterministic', 0.3], - ['Deterministic', 0.2], - ['Exponential', 8.0], - ['Exponential', 9.0]]]) - self.assertEqual(Q.c, [9, 10, 8, 8]) - self.assertEqual(Q.transition_matrix, [[[0.1, 0.2, 0.1, 0.4], - [0.2, 0.2, 0.0, 0.1], - [0.0, 0.8, 0.1, 0.1], - [0.4, 0.1, 0.1, 0.0]], - [[0.6, 0.0, 0.0, 0.2], - [0.1, 0.1, 0.2, 0.2], - [0.9, 0.0, 0.0, 0.0], - [0.2, 0.1, 0.1, 0.1]], - [[0.0, 0.0, 0.4, 0.3], - [0.1, 0.1, 0.1, 0.1], - [0.1, 0.3, 0.2, 0.2], - [0.0, 0.0, 0.0, 0.3]]]) - self.assertEqual([str(obs) for obs in Q.nodes], - ['Arrival Node', - 'Node 1', - 'Node 2', - 'Node 3', - 'Node 4', - 'Exit Node']) - self.assertEqual(Q.class_change_matrix, 'NA') - self.assertEqual(Q.schedules, [False, False, False, False]) - self.assertEqual(Q.queue_capacities, [20, 'Inf', 30, 'Inf']) - - Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, - Service_distributions = Service_distributions, - Number_of_servers = Number_of_servers, - Transition_matrices = Transition_matrices) - self.assertEqual(Q.lmbda, [[['Exponential', 3.0], - ['Exponential', 7.0], - ['Exponential', 4.0], - ['Exponential', 1.0]], - [['Exponential', 2.0], - ['Exponential', 3.0], - ['Exponential', 6.0], - ['Exponential', 4.0]], - [['Exponential', 2.0], - ['Exponential', 1.0], - ['Exponential', 2.0], - ['Exponential', 0.5]]]) - self.assertEqual(Q.mu, [[['Exponential', 7.0], - ['Exponential', 7.0], - ['Gamma', 0.4, 0.6], - ['Deterministic', 0.5]], - [['Exponential', 7.0], - ['Triangular', 0.1, 0.85, 0.8], - ['Exponential', 8.0], - ['Exponential', 5.0]], - [['Deterministic', 0.3], - ['Deterministic', 0.2], - ['Exponential', 8.0], - ['Exponential', 9.0]]]) - self.assertEqual(Q.c, [9, 10, 8, 8]) - self.assertEqual(Q.transition_matrix, [[[0.1, 0.2, 0.1, 0.4], - [0.2, 0.2, 0.0, 0.1], - [0.0, 0.8, 0.1, 0.1], - [0.4, 0.1, 0.1, 0.0]], - [[0.6, 0.0, 0.0, 0.2], - [0.1, 0.1, 0.2, 0.2], - [0.9, 0.0, 0.0, 0.0], - [0.2, 0.1, 0.1, 0.1]], - [[0.0, 0.0, 0.4, 0.3], - [0.1, 0.1, 0.1, 0.1], - [0.1, 0.3, 0.2, 0.2], - [0.0, 0.0, 0.0, 0.3]]]) - self.assertEqual([str(obs) for obs in Q.nodes], - ['Arrival Node', - 'Node 1', - 'Node 2', - 'Node 3', - 'Node 4', - 'Exit Node']) - self.assertEqual(Q.class_change_matrix, 'NA') - self.assertEqual(Q.schedules, [False, False, False, False]) - self.assertEqual(Q.queue_capacities, ['Inf', 'Inf', 'Inf', 'Inf']) - - Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, - Queue_capacities = Queue_capacities, - Service_distributions = Service_distributions, - Number_of_servers = Number_of_servers, - Transition_matrices = Transition_matrices, - Number_of_classes = Number_of_classes, - Number_of_nodes = Number_of_nodes, - Detect_deadlock = Detect_deadlock, - Class_change_matrices = Class_change_matrices) - self.assertEqual(Q.class_change_matrix, [[[0.7, 0.3, 0.0], - [0.2, 0.7, 0.1], - [0.2, 0.7, 0.1]], - [[1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0]], - [[0.7, 0.3, 0.0], - [0.2, 0.7, 0.1], - [0.2, 0.7, 0.1]], - [[1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0]]]) - - Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, - Queue_capacities = Queue_capacities, - Service_distributions = Service_distributions, - Number_of_servers = Number_of_servers2, - Transition_matrices = Transition_matrices, - Number_of_classes = Number_of_classes, - Number_of_nodes = Number_of_nodes, - Detect_deadlock = Detect_deadlock, - Class_change_matrices = Class_change_matrices, - schedule_1 = schedule_1, - Cycle_length = Cycle_length) - self.assertEqual(Q.schedules, [False, False, True, False]) - - Q = ciw.Simulation( - Arrival_distributions = {'Class 2': [['Exponential', 2.0], - ['Exponential', 1.0], - ['Exponential', 2.0], - ['Exponential', 0.5]], - 'Class 1': [['Exponential', 2.0], - ['Exponential', 3.0], - ['Exponential', 6.0], - ['Exponential', 4.0]], - 'Class 0': [['Exponential', 3.0], - ['Exponential', 7.0], - ['Exponential', 4.0], - ['Exponential', 1.0]]}, - Number_of_nodes = 4, - Detect_deadlock = False, - Number_of_servers = [9, 10, 8, 8], - Queue_capacities = [20, 'Inf', 30, 'Inf'], - Number_of_classes = 3, - Service_distributions = {'Class 2': [['Deterministic', 0.3], - ['Deterministic', 0.2], - ['Exponential', 8.0], - ['Exponential', 9.0]], - 'Class 1': [['Exponential', 7.0], - ['Triangular', 0.1, 0.85, 0.8], - ['Exponential', 8.0], - ['Exponential', 5.0]], - 'Class 0': [['Exponential', 7.0], - ['Exponential', 7.0], - ['Gamma', 0.4, 0.6], - ['Deterministic', 0.5]]}, - Transition_matrices = {'Class 2': [[0.0, 0.0, 0.4, 0.3], - [0.1, 0.1, 0.1, 0.1], - [0.1, 0.3, 0.2, 0.2], - [0.0, 0.0, 0.0, 0.3]], - 'Class 1': [[0.6, 0.0, 0.0, 0.2], - [0.1, 0.1, 0.2, 0.2], - [0.9, 0.0, 0.0, 0.0], - [0.2, 0.1, 0.1, 0.1]], - 'Class 0': [[0.1, 0.2, 0.1, 0.4], - [0.2, 0.2, 0.0, 0.1], - [0.0, 0.8, 0.1, 0.1], - [0.4, 0.1, 0.1, 0.0]]}) - self.assertEqual(Q.parameters, { - 'Arrival_distributions': {'Class 2': [['Exponential', 2.0], - ['Exponential', 1.0], - ['Exponential', 2.0], - ['Exponential', 0.5]], - 'Class 1': [['Exponential', 2.0], - ['Exponential', 3.0], - ['Exponential', 6.0], - ['Exponential', 4.0]], - 'Class 0': [['Exponential', 3.0], - ['Exponential', 7.0], - ['Exponential', 4.0], - ['Exponential', 1.0]]}, - 'Number_of_nodes': 4, - 'Detect_deadlock': False, - 'Exact': False, - 'Name': 'Simulation', - 'Number_of_servers': [9, 10, 8, 8], - 'Queue_capacities': [20, 'Inf', 30, 'Inf'], - 'Number_of_classes': 3, - 'Service_distributions': {'Class 2': [['Deterministic', 0.3], - ['Deterministic', 0.2], - ['Exponential', 8.0], - ['Exponential', 9.0]], - 'Class 1': [['Exponential', 7.0], - ['Triangular', 0.1, 0.85, 0.8], - ['Exponential', 8.0], - ['Exponential', 5.0]], - 'Class 0': [['Exponential', 7.0], - ['Exponential', 7.0], - ['Gamma', 0.4, 0.6], - ['Deterministic', 0.5]]}, - 'Transition_matrices': {'Class 2': [[0.0, 0.0, 0.4, 0.3], - [0.1, 0.1, 0.1, 0.1], - [0.1, 0.3, 0.2, 0.2], - [0.0, 0.0, 0.0, 0.3]], - 'Class 1': [[0.6, 0.0, 0.0, 0.2], - [0.1, 0.1, 0.2, 0.2], - [0.9, 0.0, 0.0, 0.0], - [0.2, 0.1, 0.1, 0.1]], - 'Class 0': [[0.1, 0.2, 0.1, 0.4], - [0.2, 0.2, 0.0, 0.1], - [0.0, 0.8, 0.1, 0.1], - [0.4, 0.1, 0.1, 0.0]]}}) - - @given(arrival_rate = floats(min_value = 0.1, max_value = 100), - service_rate = floats(min_value = 0.1, max_value = 100), - number_of_servers = integers(min_value = 1, max_value = 30), - rm = random_module()) - def test_simple_init_method(self, - arrival_rate, - service_rate, - number_of_servers, - rm): + def test_init_method(self): + N = ciw.Network_From_File( + 'ciw/tests/testing_parameters/params.yml') + Q = ciw.Simulation(N) + + self.assertEqual(len(Q.transitive_nodes), 4) + self.assertEqual(len(Q.nodes), 6) + self.assertEqual(str(Q.nodes[0]), 'Arrival Node') + self.assertEqual(str(Q.nodes[-1]), 'Exit Node') + self.assertEqual([str(n) for n in Q.transitive_nodes], + ['Node 1', 'Node 2', 'Node 3', 'Node 4']) + self.assertEqual(len(Q.inter_arrival_times), 4) + self.assertEqual(len(Q.inter_arrival_times[1]), 3) + self.assertEqual(len(Q.service_times), 4) + self.assertEqual(len(Q.service_times[1]), 3) + + + @given(arrival_rate=floats(min_value=0.1, max_value=100), + service_rate=floats(min_value=0.1, max_value=100), + number_of_servers=integers(min_value=1, max_value=30), + rm=random_module()) + def test_init_method_h(self, + arrival_rate, + service_rate, + number_of_servers, + rm): params = {'Arrival_distributions': [['Exponential', arrival_rate]], 'Service_distributions': [['Exponential', service_rate]], 'Number_of_servers': [number_of_servers], 'Transition_matrices': [[0.0]]} - Q = ciw.Simulation(params) - - expected_dictionary = { - 'Arrival_distributions': {'Class 0': [['Exponential', arrival_rate]]}, - 'Service_distributions': {'Class 0': [['Exponential', service_rate]]}, - 'Transition_matrices': {'Class 0': [[0.0]]}, - 'Number_of_servers': [number_of_servers], - 'Number_of_nodes': 1, - 'Number_of_classes': 1, - 'Name': 'Simulation', - 'Queue_capacities': ['Inf'], - 'Detect_deadlock': False, - 'Exact': False - } - self.assertEqual(Q.parameters, expected_dictionary) - self.assertEqual(Q.lmbda, [[['Exponential', arrival_rate]]]) - self.assertEqual(Q.mu, [[['Exponential', service_rate]]]) - self.assertEqual(Q.c, [number_of_servers]) - self.assertEqual(Q.transition_matrix, [[[0.0]]]) + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + + self.assertEqual(len(Q.transitive_nodes), 1) + self.assertEqual(len(Q.nodes), 3) + self.assertEqual(str(Q.nodes[0]), 'Arrival Node') + self.assertEqual(str(Q.nodes[-1]), 'Exit Node') + self.assertEqual([str(n) for n in Q.transitive_nodes], + ['Node 1']) + self.assertEqual(len(Q.inter_arrival_times), 1) + self.assertEqual(len(Q.inter_arrival_times[1]), 1) + self.assertEqual(len(Q.service_times), 1) + self.assertEqual(len(Q.service_times[1]), 1) self.assertEqual([str(obs) for obs in Q.nodes], ['Arrival Node', 'Node 1', 'Exit Node']) - self.assertEqual(Q.class_change_matrix, 'NA') - self.assertEqual(Q.schedules, [False]) - - @given(arrival_rate = floats(min_value = 0.1, max_value = 100), - service_rate = floats(min_value = 0.1, max_value = 100), - number_of_servers = integers(min_value = 1, max_value = 30), - rm=random_module()) - def test_build_mmc_parameters(self, - arrival_rate, - service_rate, - number_of_servers, - rm): - params = {'Arrival_distributions': [['Exponential', arrival_rate]], - 'Service_distributions': [['Exponential', service_rate]], - 'Number_of_servers': [number_of_servers], - 'Transition_matrices': [[0.0]]} - Q = ciw.Simulation(params) - expected_dictionary = { - 'Arrival_distributions': {'Class 0': [['Exponential', arrival_rate]]}, - 'Service_distributions': {'Class 0': [['Exponential', service_rate]]}, - 'Transition_matrices': {'Class 0': [[0.0]]}, - 'Number_of_servers': [number_of_servers], - 'Number_of_nodes': 1, - 'Number_of_classes': 1, - 'Queue_capacities': ['Inf'], - 'Detect_deadlock': False, - 'Exact': False, - 'Name': 'Simulation' - } - self.assertEqual(Q.build_parameters(params), expected_dictionary) def test_find_next_active_node_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) i = 0 for node in Q.nodes[:-1]: @@ -452,7 +81,7 @@ def test_find_next_active_node_method(self): i += 1 self.assertEqual(str(Q.find_next_active_node()), 'Arrival Node') - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) i = 10 for node in Q.nodes[:-1]: @@ -462,7 +91,7 @@ def test_find_next_active_node_method(self): def test_simulate_until_max_time_method(self): set_seed(2) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) Q.simulate_until_max_time(150) L = Q.get_all_individuals() @@ -470,7 +99,7 @@ def test_simulate_until_max_time_method(self): L[300].data_records.values()[0][0].service_start_date, 8), 8.89002862) set_seed(60) - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params_change_class.yml')) Q.simulate_until_max_time(50) L = Q.get_all_individuals() @@ -481,14 +110,16 @@ def test_simulate_until_max_time_method(self): def test_simulate_until_deadlock_method(self): set_seed(3) - Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/testing_parameters/params_deadlock.yml')) + Q = ciw.Simulation(ciw.Network_From_File( + 'ciw/tests/testing_parameters/params_deadlock.yml'), + deadlock_detector='StateDigraph') Q.simulate_until_deadlock() self.assertEqual(round(Q.times_to_deadlock[((0, 0), (0, 0))], 8), 31.26985409) def test_detect_deadlock_method(self): - Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/testing_parameters/params_deadlock.yml')) + Q = ciw.Simulation(ciw.Network_From_File( + 'ciw/tests/testing_parameters/params_deadlock.yml'), + deadlock_detector='StateDigraph') nodes = ['A', 'B', 'C', 'D', 'E'] connections = [('A', 'D'), ('A', 'B'), ('B', 'E'), ('C', 'B'), ('E', 'C')] Q.deadlock_detector.statedigraph = nx.DiGraph() @@ -498,8 +129,9 @@ def test_detect_deadlock_method(self): Q.deadlock_detector.statedigraph.add_edge(cnctn[0], cnctn[1]) self.assertEqual(Q.deadlock_detector.detect_deadlock(), True) - Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/testing_parameters/params_deadlock.yml')) + Q = ciw.Simulation(ciw.Network_From_File( + 'ciw/tests/testing_parameters/params_deadlock.yml'), + deadlock_detector='StateDigraph') nodes = ['A', 'B', 'C', 'D'] connections = [('A', 'B'), ('A', 'C'), ('B', 'C'), ('B', 'D')] Q.deadlock_detector.statedigraph = nx.DiGraph() @@ -509,8 +141,9 @@ def test_detect_deadlock_method(self): Q.deadlock_detector.statedigraph.add_edge(cnctn[0], cnctn[1]) self.assertEqual(Q.deadlock_detector.detect_deadlock(), False) - Q = ciw.Simulation(ciw.load_parameters( - 'ciw/tests/testing_parameters/params_deadlock.yml')) + Q = ciw.Simulation(ciw.Network_From_File( + 'ciw/tests/testing_parameters/params_deadlock.yml'), + deadlock_detector='StateDigraph') nodes = ['A', 'B'] Q.deadlock_detector.statedigraph = nx.DiGraph() for nd in nodes: @@ -522,9 +155,9 @@ def test_detect_deadlock_method(self): self.assertEqual(Q.deadlock_detector.detect_deadlock(), True) def test_mm1_from_file(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params_mm1.yml')) - self.assertEqual(Q.transition_matrix, [[[0.0]]]) + self.assertEqual(Q.nodes[1].transition_row, [[0.0]]) @given(arrival_rate=floats(min_value=0.1, max_value=10), service_rate=floats(min_value=0.1, max_value=10), @@ -535,84 +168,84 @@ def test_mminf_node(self, arrival_rate, service_rate, rm): 'Number_of_servers': ['Inf'], 'Transition_matrices': [[0.0]]} - Q = ciw.Simulation(params) + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Q.simulate_until_max_time(5) inds = Q.get_all_individuals() waits = [ind.data_records[1][0].wait for ind in inds] self.assertEqual(sum(waits), 0.0) - def test_raising_errors(self): - params = {'Arrival_distributions': {'Class 0':[['Exponential', 3.0]]}, - 'Service_distributions': {'Class 0':[['Exponential', 7.0]]}, - 'Number_of_servers': [9], - 'Number_of_classes': 1, - 'Transition_matrices': {'Class 0': [[0.5]]}, - 'Number_of_nodes': 1, - 'Queue_capacities': ['Inf'], - 'Detect_deadlock': False} - params_list = [copy.deepcopy(params) for i in range(28)] - - params_list[0]['Number_of_classes'] = -2 - self.assertRaises(ValueError, ciw.Simulation, params_list[0]) - params_list[1]['Number_of_nodes'] = -2 - self.assertRaises(ValueError, ciw.Simulation, params_list[1]) - params_list[2]['Number_of_servers'] = [5, 6, 7] - self.assertRaises(ValueError, ciw.Simulation, params_list[2]) - params_list[3]['Number_of_servers'] = [-3] - self.assertRaises(ValueError, ciw.Simulation, params_list[3]) - params_list[4]['Number_of_servers'] = ['my_missing_schedule'] - self.assertRaises(ValueError, ciw.Simulation, params_list[4]) - params_list[5]['Detect_deadlock'] = 'No' - self.assertRaises(ValueError, ciw.Simulation, params_list[5]) - params_list[6]['Queue_capacities'] = ['Inf', 1, 2] - self.assertRaises(ValueError, ciw.Simulation, params_list[6]) - params_list[7]['Queue_capacities'] = [-2] - self.assertRaises(ValueError, ciw.Simulation, params_list[7]) - params_list[8]['Arrival_distributions'] = {'Class 0':[['Exponential', 3.2]], - 'Class 1':[['Exponential', 2.1]]} - self.assertRaises(ValueError, ciw.Simulation, params_list[8]) - params_list[9]['Arrival_distributions'] = {'Patient 0':[['Exponential', 11.5]]} - self.assertRaises(ValueError, ciw.Simulation, params_list[9]) - params_list[10]['Arrival_distributions']['Class 0'] = [['Exponential', 3.1], - ['Exponential', 2.4]] - self.assertRaises(ValueError, ciw.Simulation, params_list[10]) - params_list[11]['Service_distributions'] = {'Class 0':[['Exponential', 3.2]], - 'Class 1':[['Exponential', 2.1]]} - self.assertRaises(ValueError, ciw.Simulation, params_list[11]) - params_list[12]['Service_distributions'] = {'Patient 0':[['Exponential', 11.5]]} - self.assertRaises(ValueError, ciw.Simulation, params_list[12]) - params_list[13]['Service_distributions']['Class 0'] = [['Exponential', 3.1], - ['Exponential', 2.4]] - self.assertRaises(ValueError, ciw.Simulation, params_list[13]) - params_list[14]['Transition_matrices'] = {'Class 0':[[0.2]], - 'Class 1':[[0.3]]} - self.assertRaises(ValueError, ciw.Simulation, params_list[14]) - params_list[15]['Transition_matrices'] = {'Patient 0':[[0.5]]} - self.assertRaises(ValueError, ciw.Simulation, params_list[15]) - params_list[16]['Transition_matrices']['Class 0'] = [[0.2], [0.1]] - self.assertRaises(ValueError, ciw.Simulation, params_list[16]) - params_list[17]['Transition_matrices']['Class 0'] = [[0.2, 0.1]] - self.assertRaises(ValueError, ciw.Simulation, params_list[17]) - params_list[18]['Transition_matrices']['Class 0'] = [[-0.6]] - self.assertRaises(ValueError, ciw.Simulation, params_list[18]) - params_list[19]['Transition_matrices']['Class 0'] = [[1.4]] - self.assertRaises(ValueError, ciw.Simulation, params_list[19]) - params_list[22]['Class_change_matrices'] = {'Node 0':[[0.0]], - 'Node 1':[[0.0]]} - self.assertRaises(ValueError, ciw.Simulation, params_list[22]) - params_list[23]['Class_change_matrices'] = {'Patient 0':[[0.0]]} - self.assertRaises(ValueError, ciw.Simulation, params_list[23]) - params_list[24]['Class_change_matrices'] = {'Node 0':[[0.1], [0.2]]} - self.assertRaises(ValueError, ciw.Simulation, params_list[24]) - params_list[25]['Class_change_matrices'] = {'Node 0':[[0.0, 0.3]]} - self.assertRaises(ValueError, ciw.Simulation, params_list[25]) - params_list[26]['Class_change_matrices'] = {'Node 0':[[-0.4]]} - self.assertRaises(ValueError, ciw.Simulation, params_list[26]) - params_list[27]['Class_change_matrices'] = {'Node 0':[[1.5]]} - self.assertRaises(ValueError, ciw.Simulation, params_list[27]) + # def test_raising_errors(self): + # params = {'Arrival_distributions': {'Class 0':[['Exponential', 3.0]]}, + # 'Service_distributions': {'Class 0':[['Exponential', 7.0]]}, + # 'Number_of_servers': [9], + # 'Number_of_classes': 1, + # 'Transition_matrices': {'Class 0': [[0.5]]}, + # 'Number_of_nodes': 1, + # 'Queue_capacities': ['Inf'], + # 'Detect_deadlock': False} + # params_list = [copy.deepcopy(params) for i in range(28)] + + # params_list[0]['Number_of_classes'] = -2 + # self.assertRaises(ValueError, ciw.Simulation, params_list[0]) + # params_list[1]['Number_of_nodes'] = -2 + # self.assertRaises(ValueError, ciw.Simulation, params_list[1]) + # params_list[2]['Number_of_servers'] = [5, 6, 7] + # self.assertRaises(ValueError, ciw.Simulation, params_list[2]) + # params_list[3]['Number_of_servers'] = [-3] + # self.assertRaises(ValueError, ciw.Simulation, params_list[3]) + # params_list[4]['Number_of_servers'] = ['my_missing_schedule'] + # self.assertRaises(ValueError, ciw.Simulation, params_list[4]) + # params_list[5]['Detect_deadlock'] = 'No' + # self.assertRaises(ValueError, ciw.Simulation, params_list[5]) + # params_list[6]['Queue_capacities'] = ['Inf', 1, 2] + # self.assertRaises(ValueError, ciw.Simulation, params_list[6]) + # params_list[7]['Queue_capacities'] = [-2] + # self.assertRaises(ValueError, ciw.Simulation, params_list[7]) + # params_list[8]['Arrival_distributions'] = {'Class 0':[['Exponential', 3.2]], + # 'Class 1':[['Exponential', 2.1]]} + # self.assertRaises(ValueError, ciw.Simulation, params_list[8]) + # params_list[9]['Arrival_distributions'] = {'Patient 0':[['Exponential', 11.5]]} + # self.assertRaises(ValueError, ciw.Simulation, params_list[9]) + # params_list[10]['Arrival_distributions']['Class 0'] = [['Exponential', 3.1], + # ['Exponential', 2.4]] + # self.assertRaises(ValueError, ciw.Simulation, params_list[10]) + # params_list[11]['Service_distributions'] = {'Class 0':[['Exponential', 3.2]], + # 'Class 1':[['Exponential', 2.1]]} + # self.assertRaises(ValueError, ciw.Simulation, params_list[11]) + # params_list[12]['Service_distributions'] = {'Patient 0':[['Exponential', 11.5]]} + # self.assertRaises(ValueError, ciw.Simulation, params_list[12]) + # params_list[13]['Service_distributions']['Class 0'] = [['Exponential', 3.1], + # ['Exponential', 2.4]] + # self.assertRaises(ValueError, ciw.Simulation, params_list[13]) + # params_list[14]['Transition_matrices'] = {'Class 0':[[0.2]], + # 'Class 1':[[0.3]]} + # self.assertRaises(ValueError, ciw.Simulation, params_list[14]) + # params_list[15]['Transition_matrices'] = {'Patient 0':[[0.5]]} + # self.assertRaises(ValueError, ciw.Simulation, params_list[15]) + # params_list[16]['Transition_matrices']['Class 0'] = [[0.2], [0.1]] + # self.assertRaises(ValueError, ciw.Simulation, params_list[16]) + # params_list[17]['Transition_matrices']['Class 0'] = [[0.2, 0.1]] + # self.assertRaises(ValueError, ciw.Simulation, params_list[17]) + # params_list[18]['Transition_matrices']['Class 0'] = [[-0.6]] + # self.assertRaises(ValueError, ciw.Simulation, params_list[18]) + # params_list[19]['Transition_matrices']['Class 0'] = [[1.4]] + # self.assertRaises(ValueError, ciw.Simulation, params_list[19]) + # params_list[22]['Class_change_matrices'] = {'Node 0':[[0.0]], + # 'Node 1':[[0.0]]} + # self.assertRaises(ValueError, ciw.Simulation, params_list[22]) + # params_list[23]['Class_change_matrices'] = {'Patient 0':[[0.0]]} + # self.assertRaises(ValueError, ciw.Simulation, params_list[23]) + # params_list[24]['Class_change_matrices'] = {'Node 0':[[0.1], [0.2]]} + # self.assertRaises(ValueError, ciw.Simulation, params_list[24]) + # params_list[25]['Class_change_matrices'] = {'Node 0':[[0.0, 0.3]]} + # self.assertRaises(ValueError, ciw.Simulation, params_list[25]) + # params_list[26]['Class_change_matrices'] = {'Node 0':[[-0.4]]} + # self.assertRaises(ValueError, ciw.Simulation, params_list[26]) + # params_list[27]['Class_change_matrices'] = {'Node 0':[[1.5]]} + # self.assertRaises(ValueError, ciw.Simulation, params_list[27]) def test_writing_data_files(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) Q.simulate_until_max_time(50) files = [x for x in os.walk( @@ -625,7 +258,7 @@ def test_writing_data_files(self): self.assertEqual('data.csv' in files, True) os.remove('ciw/tests/testing_parameters/data.csv') - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params_mm1.yml')) Q.simulate_until_max_time(50) files = [x for x in os.walk( @@ -644,14 +277,11 @@ def test_simultaneous_events_example(self): # a big affect on this. set_seed(73) - Arrival_distributions = [['Deterministic', 10.0], 'NoArrivals'] - Service_distributions = [['Deterministic', 5.0], ['Deterministic', 5.0]] - Transition_matrices = [[1.0, 0.0], [0.0, 0.0]] - Number_of_servers = [2, 1] - Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, - Service_distributions = Service_distributions, - Transition_matrices = Transition_matrices, - Number_of_servers = Number_of_servers) + params = {'Arrival_distributions': [['Deterministic', 10.0], 'NoArrivals'], + 'Service_distributions': [['Deterministic', 5.0], ['Deterministic', 5.0]], + 'Transition_matrices': [[1.0, 0.0], [0.0, 0.0]], + 'Number_of_servers': [2, 1]} + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Q.simulate_until_max_time(36) inds = Q.get_all_individuals() recs = Q.get_all_records() @@ -660,14 +290,11 @@ def test_simultaneous_events_example(self): set_seed(74) - Arrival_distributions = [['Deterministic', 10.0], 'NoArrivals'] - Service_distributions = [['Deterministic', 5.0], ['Deterministic', 5.0]] - Transition_matrices = [[1.0, 0.0], [0.0, 0.0]] - Number_of_servers = [2, 1] - Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, - Service_distributions = Service_distributions, - Transition_matrices = Transition_matrices, - Number_of_servers = Number_of_servers) + params = {'Arrival_distributions': [['Deterministic', 10.0], 'NoArrivals'], + 'Service_distributions': [['Deterministic', 5.0], ['Deterministic', 5.0]], + 'Transition_matrices': [[1.0, 0.0], [0.0, 0.0]], + 'Number_of_servers': [2, 1]} + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Q.simulate_until_max_time(36) inds = Q.get_all_individuals() recs = Q.get_all_records() @@ -676,33 +303,24 @@ def test_simultaneous_events_example(self): def test_exactness(self): set_seed(777) - Arrival_distributions = [['Exponential', 20]] - Service_distributions = [['Deterministic', 0.01]] - Transition_matrices = [[0.0]] - Number_of_servers = ['server_schedule'] - server_schedule = [[0.5, 0], [0.55, 1], [3.0, 0]] - Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, - Service_distributions = Service_distributions, - Transition_matrices = Transition_matrices, - Number_of_servers = Number_of_servers, - server_schedule = server_schedule) + params = {'Arrival_distributions': [['Exponential', 20]], + 'Service_distributions': [['Deterministic', 0.01]], + 'Transition_matrices': [[0.0]], + 'Number_of_servers': ['server_schedule'], + 'server_schedule': [[0.5, 0], [0.55, 1], [3.0, 0]]} + Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) Q.simulate_until_max_time(10) - recs = Q.get_all_records(headers = False) + recs = Q.get_all_records(headers=False) mod_service_starts = [obs%3 for obs in [r[5] for r in recs]] self.assertNotEqual(set(mod_service_starts), set([0.50, 0.51, 0.52, 0.53, 0.54])) set_seed(777) - Arrival_distributions = [['Exponential', 20]] - Service_distributions = [['Deterministic', 0.01]] - Transition_matrices = [[0.0]] - Number_of_servers = ['server_schedule'] - server_schedule = [[0.5, 0], [0.55, 1], [3.0, 0]] - Q = ciw.Simulation(Arrival_distributions = Arrival_distributions, - Service_distributions = Service_distributions, - Transition_matrices = Transition_matrices, - Number_of_servers = Number_of_servers, - server_schedule = server_schedule, - Exact = 14) + params = {'Arrival_distributions': [['Exponential', 20]], + 'Service_distributions': [['Deterministic', 0.01]], + 'Transition_matrices': [[0.0]], + 'Number_of_servers': ['server_schedule'], + 'server_schedule': [[0.5, 0], [0.55, 1], [3.0, 0]]} + Q = ciw.Simulation(ciw.Network_From_Dictionary(params), exact=14) Q.simulate_until_max_time(10) recs = Q.get_all_records(headers=False) mod_service_starts = [obs%3 for obs in [r[5] for r in recs]] diff --git a/ciw/tests/test_state_tracker.py b/ciw/tests/test_state_tracker.py index f22087a7..511d58c5 100644 --- a/ciw/tests/test_state_tracker.py +++ b/ciw/tests/test_state_tracker.py @@ -4,14 +4,14 @@ class TestStateTracker(unittest.TestCase): def test_base_init_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.simulation, Q) self.assertEqual(B.state, None) def test_base_change_state_accept_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.state, None) @@ -19,7 +19,7 @@ def test_base_change_state_accept_method(self): self.assertEqual(B.state, None) def test_base_change_state_block_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.state, None) @@ -27,7 +27,7 @@ def test_base_change_state_block_method(self): self.assertEqual(B.state, None) def test_base_change_state_release_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.state, None) @@ -35,15 +35,15 @@ def test_base_change_state_release_method(self): self.assertEqual(B.state, None) def test_base_hash_state_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.hash_state(), None) def test_base_release_method_within_simulation(self): - params = ciw.load_parameters( + Net = ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml') - Q = ciw.Simulation(params) + Q = ciw.Simulation(Net) N = Q.transitive_nodes[2] inds = [ciw.Individual(i) for i in xrange(5)] N.individuals = inds @@ -60,18 +60,18 @@ def test_base_release_method_within_simulation(self): self.assertEqual(Q.statetracker.state, None) def test_base_block_method_within_simulation(self): - params = ciw.load_parameters( + Net = ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml') - Q = ciw.Simulation(params) + Q = ciw.Simulation(Net) N = Q.transitive_nodes[2] self.assertEqual(Q.statetracker.state, None) N.block_individual(ciw.Individual(1), Q.nodes[1]) self.assertEqual(Q.statetracker.state, None) def test_base_accept_method_within_simulation(self): - params = ciw.load_parameters( + Net = ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml') - Q = ciw.Simulation(params) + Q = ciw.Simulation(Net) N = Q.transitive_nodes[2] self.assertEqual(Q.statetracker.state, None) N.accept(ciw.Individual(3, 2), 45.6) @@ -83,14 +83,14 @@ def test_base_accept_method_within_simulation(self): class TestNaiveTracker(unittest.TestCase): def test_naive_init_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) self.assertEqual(B.simulation, Q) self.assertEqual(B.state, [[0, 0], [0, 0], [0, 0], [0, 0]]) def test_naive_change_state_accept_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) self.assertEqual(B.state, [[0, 0], [0, 0], [0, 0], [0, 0]]) @@ -98,7 +98,7 @@ def test_naive_change_state_accept_method(self): self.assertEqual(B.state, [[1, 0], [0, 0], [0, 0], [0, 0]]) def test_naive_change_state_block_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) B.state = [[1, 0], [0, 0], [0, 0], [0, 0]] @@ -106,7 +106,7 @@ def test_naive_change_state_block_method(self): self.assertEqual(B.state, [[0, 1], [0, 0], [0, 0], [0, 0]]) def test_naive_change_state_release_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) B.state = [[2, 1], [3, 0], [1, 0], [4, 4]] @@ -116,17 +116,16 @@ def test_naive_change_state_release_method(self): self.assertEqual(B.state, [[1, 0], [3, 0], [1, 0], [4, 4]]) def test_naive_hash_state_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) B.state = [[3, 4], [1, 2], [0, 1], [0, 0]] self.assertEqual(B.hash_state(), ((3, 4), (1, 2), (0, 1), (0, 0))) def test_naive_release_method_within_simulation(self): - params = ciw.load_parameters( + params = ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml') - params['Tracker'] = 'Naive' - Q = ciw.Simulation(params) + Q = ciw.Simulation(params, tracker='Naive') N = Q.transitive_nodes[2] inds = [ciw.Individual(i) for i in xrange(5)] N.individuals = inds @@ -144,10 +143,9 @@ def test_naive_release_method_within_simulation(self): self.assertEqual(Q.statetracker.state, [[6, 1], [3, 0], [3, 0], [0, 0]]) def test_naive_block_method_within_simulation(self): - params = ciw.load_parameters( + params = ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml') - params['Tracker'] = 'Naive' - Q = ciw.Simulation(params) + Q = ciw.Simulation(params, tracker='Naive') N = Q.transitive_nodes[2] Q.statetracker.state = [[4, 1], [3, 0], [5, 1], [0, 0]] self.assertEqual(Q.statetracker.state, [[4, 1], [3, 0], [5, 1], [0, 0]]) @@ -155,10 +153,9 @@ def test_naive_block_method_within_simulation(self): self.assertEqual(Q.statetracker.state, [[4, 1], [3, 0], [4, 2], [0, 0]]) def test_naive_accept_method_within_simulation(self): - params = ciw.load_parameters( + params = ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml') - params['Tracker'] = 'Naive' - Q = ciw.Simulation(params) + Q = ciw.Simulation(params, tracker='Naive') N = Q.transitive_nodes[2] self.assertEqual(Q.statetracker.state, [[0, 0], [0, 0], [0, 0], [0, 0]]) N.accept(ciw.Individual(3, 2), 45.6) @@ -170,7 +167,7 @@ def test_naive_accept_method_within_simulation(self): class TestMatrixTracker(unittest.TestCase): def test_matrix_init_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) self.assertEqual(B.simulation, Q) @@ -181,7 +178,7 @@ def test_matrix_init_method(self): [0, 0, 0, 0]]) def test_matrix_change_state_accept_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) self.assertEqual(B.state, [[[[], [], [], []], @@ -197,7 +194,7 @@ def test_matrix_change_state_accept_method(self): [1, 0, 0, 0]]) def test_matrix_change_state_block_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) B.state = [[[[], [], [], []], @@ -225,7 +222,7 @@ def test_matrix_change_state_block_method(self): [2, 3, 1, 0]]) def test_matrix_change_state_release_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) B.state = [[[[], [], [1, 3], []], @@ -247,7 +244,7 @@ def test_matrix_change_state_release_method(self): [1, 3, 0, 0]]) def test_matrix_hash_state_method(self): - Q = ciw.Simulation(ciw.load_parameters( + Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) B.state = [[[[], [], [1, 3], []], @@ -262,10 +259,9 @@ def test_matrix_hash_state_method(self): (2, 3, 0, 0))) def test_matrix_release_method_within_simulation(self): - params = ciw.load_parameters( + params = ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml') - params['Tracker'] = 'Matrix' - Q = ciw.Simulation(params) + Q = ciw.Simulation(params, tracker='Matrix') N = Q.transitive_nodes[2] inds = [ciw.Individual(i) for i in xrange(5)] N.individuals = inds @@ -304,10 +300,9 @@ def test_matrix_release_method_within_simulation(self): [7, 3, 3, 0]]) def test_matrix_block_method_within_simulation(self): - params = ciw.load_parameters( + params = ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml') - params['Tracker'] = 'Matrix' - Q = ciw.Simulation(params) + Q = ciw.Simulation(params, tracker='Matrix') N = Q.transitive_nodes[2] Q.statetracker.state = [[[[], [2], [], []], [[], [], [], []], @@ -328,10 +323,9 @@ def test_matrix_block_method_within_simulation(self): [5, 3, 6, 0]]) def test_matrix_accept_method_within_simulation(self): - params = ciw.load_parameters( + params = ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml') - params['Tracker'] = 'Matrix' - Q = ciw.Simulation(params) + Q = ciw.Simulation(params, tracker='Matrix') N = Q.transitive_nodes[2] self.assertEqual(Q.statetracker.state, [[[[], [], [], []], [[], [], [], []], diff --git a/ciw/tests/testing_parameters/params.yml b/ciw/tests/testing_parameters/params.yml index 7d32903c..34ed97ef 100644 --- a/ciw/tests/testing_parameters/params.yml +++ b/ciw/tests/testing_parameters/params.yml @@ -26,7 +26,6 @@ Arrival_distributions: - 2.0 - - Exponential - 0.5 -Detect_deadlock: False Number_of_classes: 3 Number_of_nodes: 4 Number_of_servers: diff --git a/ciw/tests/testing_parameters/params_change_class.yml b/ciw/tests/testing_parameters/params_change_class.yml index c74f2120..dae8883f 100644 --- a/ciw/tests/testing_parameters/params_change_class.yml +++ b/ciw/tests/testing_parameters/params_change_class.yml @@ -9,7 +9,6 @@ Arrival_distributions: - 0.04 - - Exponential - 0.06 -Detect_deadlock: False Number_of_classes: 2 Number_of_nodes: 2 Number_of_servers: @@ -42,12 +41,12 @@ Transition_matrices: - - 0.2 - 0.0 Class_change_matrices: - Node 0: + Node 1: - - 0.5 - 0.5 - - 0.5 - 0.5 - Node 1: + Node 2: - - 1.0 - 0.0 - - 0.0 diff --git a/ciw/tests/testing_parameters/params_custom_dist.yml b/ciw/tests/testing_parameters/params_custom_dist.yml index eb7b44e0..3269e526 100644 --- a/ciw/tests/testing_parameters/params_custom_dist.yml +++ b/ciw/tests/testing_parameters/params_custom_dist.yml @@ -9,7 +9,6 @@ Arrival_distributions: - 3.0 - - Exponential - 5.0 -Detect_deadlock: False Number_of_classes: 2 Number_of_nodes: 2 Number_of_servers: @@ -21,14 +20,14 @@ Queue_capacities: Service_distributions: Class 0: - - Custom - - customdist1 + - [[0.3, 5.0], [0.3, 5.5], [0.4, 6.0]] - - Exponential - 0.6 Class 1: - - Custom - - customdist1 + - [[0.3, 5.0], [0.3, 5.5], [0.4, 6.0]] - - Custom - - customdist2 + - [[0.1, 1.1], [0.1, 1.2], [0.2, 1.3], [0.2, 1.4], [0.1, 1.5], [0.1, 1.9], [0.1, 2.1], [0.1, 2.3]] Simulation_time: 2500 Transition_matrices: Class 0: @@ -41,27 +40,3 @@ Transition_matrices: - 0.0 - - 0.0 - 0.1 -customdist1: - - - 0.3 - - 5.0 - - - 0.3 - - 5.5 - - - 0.4 - - 6.0 -customdist2: - - - 0.1 - - 1.1 - - - 0.1 - - 1.2 - - - 0.2 - - 1.3 - - - 0.2 - - 1.4 - - - 0.1 - - 1.5 - - - 0.1 - - 1.9 - - - 0.1 - - 2.1 - - - 0.1 - - 2.3 diff --git a/ciw/tests/testing_parameters/params_schedule.yml b/ciw/tests/testing_parameters/params_schedule.yml index cfc4394f..1d28b043 100644 --- a/ciw/tests/testing_parameters/params_schedule.yml +++ b/ciw/tests/testing_parameters/params_schedule.yml @@ -9,7 +9,6 @@ Arrival_distributions: - 0.04 - - Exponential - 0.06 -Detect_deadlock: False Number_of_classes: 2 Number_of_nodes: 2 Number_of_servers: From e8531e48c35edaa19f50f740d39b141b7246e2cf Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Wed, 20 Apr 2016 14:45:04 +0100 Subject: [PATCH 16/20] Error checking Network_From_Dictionary --- ciw/import_params.py | 184 ++++++++++++++++++--- ciw/simulation.py | 136 ---------------- ciw/tests/test_network.py | 68 +++++++- ciw/tests/test_sampling.py | 304 +++++++++++++++++------------------ ciw/tests/test_simulation.py | 71 -------- 5 files changed, 375 insertions(+), 388 deletions(-) diff --git a/ciw/import_params.py b/ciw/import_params.py index e2574205..16712ce0 100644 --- a/ciw/import_params.py +++ b/ciw/import_params.py @@ -15,29 +15,23 @@ def load_parameters(directory_name): parameter_file.close() return parameters + def Network_From_Dictionary(params): """ Creates a Network object from a parameters dictionary """ - if isinstance(params['Arrival_distributions'], dict): - arrivals = [params['Arrival_distributions']['Class ' + str(cls)] - for cls in xrange(len(params['Arrival_distributions']))] - if isinstance(params['Arrival_distributions'], list): - arrivals = [params['Arrival_distributions']] - if isinstance(params['Service_distributions'], dict): - services = [params['Service_distributions']['Class ' + str(cls)] - for cls in xrange(len(params['Service_distributions']))] - if isinstance(params['Service_distributions'], list): - services = [params['Service_distributions']] - if isinstance(params['Transition_matrices'], dict): - transitions = [params['Transition_matrices']['Class ' + str(cls)] - for cls in xrange(len(params['Transition_matrices']))] - if isinstance(params['Transition_matrices'], list): - transitions = [params['Transition_matrices']] - number_of_classes = params.get('Number_of_classes', len(arrivals)) - number_of_nodes = params.get('Number_of_nodes', len(arrivals[0])) - queueing_capacities = params.get('Queue_capacities', - ['Inf' for i in xrange(number_of_nodes)]) + fill_out_dictionary(params) + validify_dictionary(params) + # Then make the Network object + arrivals = [params['Arrival_distributions']['Class ' + str(cls)] + for cls in xrange(len(params['Arrival_distributions']))] + services = [params['Service_distributions']['Class ' + str(cls)] + for cls in xrange(len(params['Service_distributions']))] + transitions = [params['Transition_matrices']['Class ' + str(cls)] + for cls in xrange(len(params['Transition_matrices']))] + number_of_classes = params['Number_of_classes'] + number_of_nodes = params['Number_of_nodes'] + queueing_capacities = params['Queue_capacities'] class_change_matrices = params.get('Class_change_matrices', {'Node ' + str(nd + 1): None for nd in xrange(number_of_nodes)}) number_of_servers, schedules, nodes, classes = [], [], [], [] @@ -61,9 +55,159 @@ def Network_From_Dictionary(params): transitions[cls])) return Network(nodes, classes) + def Network_From_File(directory_name): """ Creates a Network object form a yaml file """ params = load_parameters(directory_name) - return Network_From_Dictionary(params) \ No newline at end of file + fill_out_dictionary(params) + validify_dictionary(params) + return Network_From_Dictionary(params) + + +def fill_out_dictionary(params): + """ + Fills out the parameters dictionary with the + optional arguments + """ + if isinstance(params['Arrival_distributions'], list): + arr_dists = params['Arrival_distributions'] + params['Arrival_distributions'] = {'Class 0': arr_dists} + if isinstance(params['Service_distributions'], list): + srv_dists = params['Service_distributions'] + params['Service_distributions'] = {'Class 0': srv_dists} + if isinstance(params['Transition_matrices'], list): + trns_mat = params['Transition_matrices'] + params['Transition_matrices'] = {'Class 0': trns_mat} + + default_dict = { + 'Name': 'Simulation', + 'Number_of_nodes': len(params['Number_of_servers']), + 'Number_of_classes': len(params['Arrival_distributions']), + 'Queue_capacities': ['Inf' for _ in xrange(len( + params['Number_of_servers']))], + } + + for a in default_dict: + params[a] = params.get(a, default_dict[a]) + return params + + +def validify_dictionary(params): + """ + Raises errors if there is something wrong with the + parameters dictionary + """ + consistant_num_classes = ( + params['Number_of_classes'] == + len(params['Arrival_distributions']) == + len(params['Service_distributions']) == + len(params['Transition_matrices'])) + if not consistant_num_classes: + raise ValueError('Ensure consistant number of classes is used throughout.') + consistant_class_names = ( + set(params['Arrival_distributions']) == + set(params['Service_distributions']) == + set(params['Transition_matrices']) == + set(['Class ' + str(i) for i in range(params['Number_of_classes'])])) + if not consistant_class_names: + raise ValueError('Ensure correct names for customer classes.') + num_nodes_count = [ + params['Number_of_nodes']] + [ + len(obs) for obs in params['Arrival_distributions'].values()] + [ + len(obs) for obs in params['Service_distributions'].values()] + [ + len(obs) for obs in params['Transition_matrices'].values()] + [ + len(row) for row in obs for obs in params['Transition_matrices'].values()] + [ + len(params['Number_of_servers'])] + [ + len(params['Queue_capacities'])] + if len(set(num_nodes_count)) != 1: + raise ValueError('Ensure consistant number of nodes is used throughout.') + for cls in params['Transition_matrices'].values(): + for row in cls: + if sum(row) > 1.0 or min(row) < 0.0 or max(row) > 1.0: + raise ValueError('Ensure that transition matrix is valid.') + dists = [params['Service_distributions']['Class ' + str(i)][j][0] for i in range(params['Number_of_classes']) for j in range(params['Number_of_nodes'])] + [ + params['Arrival_distributions']['Class ' + str(i)][j][0] for i in range(params['Number_of_classes']) for j in range(params['Number_of_nodes']) if params['Arrival_distributions']['Class ' + str(i)][j] != 'NoArrivals'] + if not set(dists).issubset(set([ + 'Uniform', 'Triangular', 'Deterministic', + 'Exponential', 'Gamma', 'Lognormal', + 'Weibull', 'Empirical', 'Custom', 'UserDefined'])): + raise ValueError('Ensure that valid Arrival and Service Distributions are used.') + neg_numservers = any([(isinstance(obs, int) and obs <= 0) for obs in params['Number_of_servers']]) + valid_capacities = all([((isinstance(obs, int) and obs >= 0) or obs=='Inf') for obs in params['Queue_capacities']]) + if neg_numservers: + raise ValueError('Number of servers must be positive integers.') + if not valid_capacities: + raise ValueError('Queue capacities must be positive integers or zero.') + if 'Class_change_matrices' in params: + num_nodes = len(params['Class_change_matrices']) == params['Number_of_nodes'] + node_names = set(params['Class_change_matrices']) == set(['Node ' + str(i+1) for i in range(params['Number_of_nodes'])]) + if not (num_nodes and node_names): + raise ValueError('Ensure correct nodes used in Class_change_matrices.') + for nd in params['Class_change_matrices'].values(): + for row in nd: + if sum(row) > 1.0 or min(row) < 0.0 or max(row) > 1.0: + raise ValueError('Ensure that class change matrix is valid.') + for n in params['Number_of_servers']: + if isinstance(n, str) and n != 'Inf': + if n not in params: + raise ValueError('No schedule ' + str(n) + ' defined.') + + # Distribution parameters::: + for cls in params['Arrival_distributions'].values(): + for nd in cls: + if nd != 'NoArrivals': + if nd[0] == 'Uniform': + if nd[1] < 0.0 or nd[2] < 0.0: + raise ValueError('Uniform distribution must sample positive numbers only.') + if nd[2] <= nd[1]: + raise ValueError('Upper limit of Uniform distribution must be greater than the lower limit.') + if nd[0] == 'Deterministic': + if nd[1] < 0.0: + raise ValueError('Deterministic distribution must sample positive numbers only.') + if nd[0] == 'Triangular': + if nd[1] < 0.0 or nd[2] < 0.0 or nd[3] < 0.0: + raise ValueError('Triangular distribution must sample positive numbers only.') + if nd[1] > nd[2] or nd[1] >= nd[3] or nd[3] >= nd[2]: + raise ValueError('Triangular distribution\'s median must lie between the lower and upper limits.') + if nd[0] == 'Custom': + P, V = zip(*nd[1]) + for el in P: + if not isinstance(el, float) or el < 0.0: + raise ValueError('Probabilities for Custom distribution need to be floats between 0.0 and 1.0.') + for el in V: + if el < 0.0: + raise ValueError('Custom distribution must sample positive values only.') + if nd[0] == 'Empirical': + if isinstance(nd[1], list): + if any([el<0.0 for el in nd[1]]): + raise ValueError('Empirical distribution must sample positive floats.') + for cls in params['Service_distributions'].values(): + for nd in cls: + if nd[0] == 'Uniform': + if nd[1] < 0.0 or nd[2] < 0.0: + raise ValueError('Uniform distribution must sample positive numbers only.') + if nd[2] <= nd[1]: + raise ValueError('Upper limit of Uniform distribution must be greater than the lower limit.') + if nd[0] == 'Deterministic': + if nd[1] < 0.0: + raise ValueError('Deterministic distribution must sample positive numbers only.') + if nd[0] == 'Triangular': + if nd[1] < 0.0 or nd[2] < 0.0 or nd[3] < 0.0: + raise ValueError('Triangular distribution must sample positive numbers only.') + if nd[1] > nd[2] or nd[1] >= nd[3] or nd[3] >= nd[2]: + raise ValueError('Triangular distribution\'s median must lie between the lower and upper limits.') + if nd[0] == 'Custom': + P, V = zip(*nd[1]) + for el in P: + if not isinstance(el, float) or el < 0.0: + raise ValueError('Probabilities for Custom distribution need to be floats between 0.0 and 1.0.') + for el in V: + if el < 0.0: + raise ValueError('Custom distribution must sample positive values only.') + if nd[0] == 'Empirical': + if isinstance(nd[1], list): + if any([el<0.0 for el in nd[1]]): + raise ValueError('Empirical distribution must sample positive floats.') + diff --git a/ciw/simulation.py b/ciw/simulation.py index de425c2c..c858cc6f 100644 --- a/ciw/simulation.py +++ b/ciw/simulation.py @@ -28,7 +28,6 @@ def __init__(self, network, exact=False, name='Simulation', tracker=False, deadl Initialise a queue instance. """ self.network = network - # self.check_valid_parameters(network) if not exact: NodeType = Node ArrivalNodeType = ArrivalNode @@ -65,141 +64,6 @@ def check_userdef_dist(self, func): raise ValueError("UserDefined function must return positive float.") return sample - def check_valid_parameters(self): - """ - Raises errors if parameter set isn't valid - """ - if not isinstance(self.parameters['Number_of_classes'], int) or self.parameters['Number_of_classes'] <= 0: - raise ValueError('Number_of_classes must be a positive integer.') - if not isinstance(self.parameters['Number_of_nodes'], int) or self.parameters['Number_of_nodes'] <= 0: - raise ValueError('Number_of_nodes must be a positive integer.') - if len(self.parameters['Number_of_servers']) != self.parameters['Number_of_nodes']: - raise ValueError('Number_of_servers must be list of length Number_of_nodes.') - for x in self.parameters['Number_of_servers']: - if isinstance(x, int): - if x < 0: - raise ValueError('Number_of_servers must be list of positive integers or valid server schedules.') - if isinstance(x, str): - if x != 'Inf': - if x not in self.parameters: - raise ValueError('Number_of_servers must be list of positive integers or valid server schedules.') - if self.parameters['Detect_deadlock'] not in set([False, 'StateDigraph']): - raise ValueError('Detect_deadlock must be a boolean.') - if len(self.parameters['Queue_capacities']) != self.parameters['Number_of_nodes']: - raise ValueError('Queue_capacities must be list of length Number_of_nodes.') - for x in self.parameters['Queue_capacities']: - if isinstance(x, int): - if x < 0: - raise ValueError('Queue_capacities must be list of positive integers.') - if not isinstance(self.parameters['Arrival_distributions'], dict) or len(self.parameters['Arrival_distributions']) != self.parameters['Number_of_classes']: - raise ValueError('Arrival_distributions must be dictionary with classes as keys.') - for x in self.parameters['Arrival_distributions'].keys(): - if not isinstance(x, str) or x[:6] != 'Class ': - raise ValueError('Keys of Arrival_distributions must be strings numbered "Class #".') - for x in self.parameters['Arrival_distributions'].values(): - if not isinstance(x, list) or len(x) != self.parameters['Number_of_nodes']: - raise ValueError('Arrival_distributions for each class must be a list of length Number_of_nodes') - if not isinstance(self.parameters['Service_distributions'], dict) or len(self.parameters['Service_distributions']) != self.parameters['Number_of_classes']: - raise ValueError('Service_distributions must be dictionary with classes as keys.') - for x in self.parameters['Service_distributions'].keys(): - if not isinstance(x, str) or x[:6] != 'Class ': - raise ValueError('Keys of Service_distributions must be strings numbered "Class #".') - for x in self.parameters['Service_distributions'].values(): - if not isinstance(x, list) or len(x) != self.parameters['Number_of_nodes']: - raise ValueError('Service_distributions for each class must be a list of length Number_of_nodes') - if not isinstance(self.parameters['Transition_matrices'], dict) or len(self.parameters['Transition_matrices']) != self.parameters['Number_of_classes']: - raise ValueError('Transition_matrices must be dictionary with classes as keys.') - for x in self.parameters['Transition_matrices'].keys(): - if not isinstance(x, str) or x[:6] != 'Class ': - raise ValueError('Keys of Transition_matrices must be strings numbered "Class #".') - for x in self.parameters['Transition_matrices'].values(): - if not isinstance(x, list) or len(x) != self.parameters['Number_of_nodes']: - raise ValueError('Transition_matrices for each class must be list of lists of shape Number_of_nodes x Number_of_nodes.') - for y in x: - if not isinstance(y, list) or len(y) != self.parameters['Number_of_nodes']: - raise ValueError('Transition_matrices for each class must be list of lists of shape Number_of_nodes x Number_of_nodes.') - for z in y: - if not isinstance(z, float) or z < 0.0: - raise ValueError('Entries of Transition_matrices must be floats between 0.0 and 1.0.') - if sum(y) > 1.0: - raise ValueError('Rows of Transition_matrices must sum to 1.0 or less.') - if 'Class_change_matrices' in self.parameters: - if not isinstance(self.parameters['Class_change_matrices'], dict) or len(self.parameters['Class_change_matrices']) != self.parameters['Number_of_nodes']: - raise ValueError('Class_change_matrices must be dictionary with nodes as keys.') - for x in self.parameters['Class_change_matrices'].keys(): - if not isinstance(x, str) or x[:5] != 'Node ': - raise ValueError('Keys of Class_change_matrices must be strings numbered "Node #".') - for x in self.parameters['Class_change_matrices'].values(): - if not isinstance(x, list) or len(x) != self.parameters['Number_of_classes']: - raise ValueError('Class_change_matrices for each class must be list of lists of shape Number_of_classes x Number_of_classes.') - for y in x: - if not isinstance(y, list) or len(y) != self.parameters['Number_of_classes']: - raise ValueError('Class_change_matrices for each class must be list of lists of shape Number_of_classes x Number_of_classes.') - for z in y: - if not isinstance(z, float) or z < 0.0: - raise ValueError('Entries of Class_change_matrices must be floats between 0.0 and 1.0.') - if sum(y) > 1.0: - raise ValueError('Rows of Class_change_matrices must sum to 1.0 or less.') - for cls in self.parameters['Service_distributions'].values(): - for nd in cls: - if nd[0] not in ['Uniform', 'Triangular', 'Deterministic', 'Exponential', 'Gamma', 'Lognormal', 'Weibull', 'Empirical', 'Custom', 'UserDefined']: - raise ValueError("Service distribution must be one of 'Uniform', 'Triangular', 'Deterministic', 'Exponential', 'Gamma', 'Lognormal', 'Weibull', 'Empirical', 'Custom', or 'UserDefined'") - if nd[0] == 'Uniform': - if nd[1] < 0.0 or nd[2] < 0.0: - raise ValueError('Uniform distribution must sample positive numbers only.') - if nd[2] <= nd[1]: - raise ValueError('Upper limit of Uniform distribution must be greater than the lower limit.') - if nd[0] == 'Deterministic': - if nd[1] < 0.0: - raise ValueError('Deterministic distribution must sample positive numbers only.') - if nd[0] == 'Triangular': - if nd[1] < 0.0 or nd[2] < 0.0 or nd[3] < 0.0: - raise ValueError('Triangular distribution must sample positive numbers only.') - if nd[1] > nd[2] or nd[1] >= nd[3] or nd[3] >= nd[2]: - raise ValueError('Triangular distribution\'s median must lie between the lower and upper limits.') - if nd[0] == 'Custom': - P, V = zip(*self.parameters[nd[1]]) - for el in P: - if not isinstance(el, float) or el < 0.0: - raise ValueError('Probabilities for Custom distribution need to be floats between 0.0 and 1.0.') - for el in V: - if el < 0.0: - raise ValueError('Custom distribution must sample positive values only.') - if nd[0] == 'Empirical': - if isinstance(nd[1], list): - if any([el<0.0 for el in nd[1]]): - raise ValueError('Empirical distribution must sample positive floats.') - for cls in self.parameters['Arrival_distributions'].values(): - for nd in cls: - if nd != 'NoArrivals': - if nd[0] not in ['Uniform', 'Triangular', 'Deterministic', 'Exponential', 'Gamma', 'Lognormal', 'Weibull', 'Empirical', 'Custom', 'UserDefined']: - raise ValueError("Arrival distribution must be one of 'Uniform', 'Triangular', 'Deterministic', 'Exponential', 'Gamma', 'Lognormal', 'Weibull', 'Empirical', 'Custom', 'UserDefined', or 'NoArrivals'.") - if nd[0] == 'Uniform': - if nd[1] < 0.0 or nd[2] < 0.0: - raise ValueError('Uniform distribution must sample positive numbers only.') - if nd[2] <= nd[1]: - raise ValueError('Upper limit of Uniform distribution must be greater than the lower limit.') - if nd[0] == 'Deterministic': - if nd[1] < 0.0: - raise ValueError('Deterministic distribution must sample positive numbers only.') - if nd[0] == 'Triangular': - if nd[1] < 0.0 or nd[2] < 0.0 or nd[3] < 0.0: - raise ValueError('Triangular distribution must sample positive numbers only.') - if nd[1] > nd[2] or nd[1] >= nd[3] or nd[3] >= nd[2]: - raise ValueError('Triangular distribution\'s median must lie between the lower and upper limits.') - if nd[0] == 'Custom': - P, V = zip(*self.parameters[nd[1]]) - for el in P: - if not isinstance(el, float) or el < 0.0: - raise ValueError('Probabilities for Custom distribution need to be floats between 0.0 and 1.0.') - for el in V: - if el < 0.0: - raise ValueError('Custom distribution must sample positive values only.') - if nd[0] == 'Empirical': - if isinstance(nd[1], list): - if any([el<0.0 for el in nd[1]]): - raise ValueError('Empirical distribution must sample positive floats.') - def choose_tracker(self, tracker, deadlock_detector): """ Chooses the state tracker to use for the simulation. diff --git a/ciw/tests/test_network.py b/ciw/tests/test_network.py index 2efdc069..dd88afc4 100644 --- a/ciw/tests/test_network.py +++ b/ciw/tests/test_network.py @@ -1,5 +1,6 @@ import unittest import ciw +import copy from hypothesis import given from hypothesis.strategies import floats, integers, lists, random_module @@ -181,4 +182,69 @@ def test_network_from_file(self): self.assertEqual(N.customer_classes[2].service_distributions, [['Deterministic', 0.3], ['Deterministic', 0.2], ['Exponential', 8.0], ['Exponential', 9.0]]) self.assertEqual(N.customer_classes[0].transition_matrix, [[0.1, 0.2, 0.1, 0.4], [0.2, 0.2, 0.0, 0.1], [0.0, 0.8, 0.1, 0.1], [0.4, 0.1, 0.1, 0.0]]) self.assertEqual(N.customer_classes[1].transition_matrix, [[0.6, 0.0, 0.0, 0.2], [0.1, 0.1, 0.2, 0.2], [0.9, 0.0, 0.0, 0.0], [0.2, 0.1, 0.1, 0.1]]) - self.assertEqual(N.customer_classes[2].transition_matrix, [[0.0, 0.0, 0.4, 0.3], [0.1, 0.1, 0.1, 0.1], [0.1, 0.3, 0.2, 0.2], [0.0, 0.0, 0.0, 0.3]]) \ No newline at end of file + self.assertEqual(N.customer_classes[2].transition_matrix, [[0.0, 0.0, 0.4, 0.3], [0.1, 0.1, 0.1, 0.1], [0.1, 0.3, 0.2, 0.2], [0.0, 0.0, 0.0, 0.3]]) + + def test_raising_errors(self): + params = {'Arrival_distributions': {'Class 0':[['Exponential', 3.0]]}, + 'Service_distributions': {'Class 0':[['Exponential', 7.0]]}, + 'Number_of_servers': [9], + 'Number_of_classes': 1, + 'Transition_matrices': {'Class 0': [[0.5]]}, + 'Number_of_nodes': 1, + 'Queue_capacities': ['Inf'], + 'Detect_deadlock': False} + params_list = [copy.deepcopy(params) for i in range(23)] + + params_list[0]['Number_of_classes'] = -2 + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[0]) + params_list[1]['Number_of_nodes'] = -2 + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[1]) + params_list[2]['Number_of_servers'] = [5, 6, 7] + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[2]) + params_list[3]['Number_of_servers'] = [-3] + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[3]) + params_list[4]['Number_of_servers'] = ['my_missing_schedule'] + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[4]) + params_list[5]['Queue_capacities'] = ['Inf', 1, 2] + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[5]) + params_list[6]['Queue_capacities'] = [-2] + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[6]) + params_list[7]['Arrival_distributions'] = {'Class 0':[['Exponential', 3.2]], + 'Class 1':[['Exponential', 2.1]]} + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[7]) + params_list[8]['Arrival_distributions'] = {'Patient 0':[['Exponential', 11.5]]} + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[8]) + params_list[9]['Arrival_distributions']['Class 0'] = [['Exponential', 3.1], + ['Exponential', 2.4]] + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[9]) + params_list[10]['Service_distributions'] = {'Class 0':[['Exponential', 3.2]], + 'Class 1':[['Exponential', 2.1]]} + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[10]) + params_list[11]['Service_distributions'] = {'Patient 0':[['Exponential', 11.5]]} + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[11]) + params_list[12]['Service_distributions']['Class 0'] = [['Exponential', 3.1], + ['Exponential', 2.4]] + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[12]) + params_list[13]['Transition_matrices'] = {'Class 0':[[0.2]], + 'Class 1':[[0.3]]} + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[13]) + params_list[14]['Transition_matrices'] = {'Patient 0':[[0.5]]} + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[14]) + params_list[15]['Transition_matrices']['Class 0'] = [[0.2], [0.1]] + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[15]) + params_list[16]['Transition_matrices']['Class 0'] = [[0.2, 0.1]] + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[16]) + params_list[17]['Transition_matrices']['Class 0'] = [[-0.6]] + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[17]) + params_list[18]['Transition_matrices']['Class 0'] = [[1.4]] + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[18]) + params_list[19]['Class_change_matrices'] = {'Node 1':[[0.0]], + 'Node 2':[[0.0]]} + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[19]) + params_list[20]['Class_change_matrices'] = {'Patient 0':[[0.0]]} + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[20]) + params_list[21]['Class_change_matrices'] = {'Node 1':[[-0.4]]} + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[21]) + params_list[22]['Class_change_matrices'] = {'Node 1':[[1.5]]} + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[22]) + diff --git a/ciw/tests/test_sampling.py b/ciw/tests/test_sampling.py index eacb5eac..d1b24011 100644 --- a/ciw/tests/test_sampling.py +++ b/ciw/tests/test_sampling.py @@ -74,40 +74,36 @@ def test_sampling_uniform_dist_hypothesis(self, u, rm): self.assertTrue(ul <= Nu.simulation.service_times[Nu.id_number][0]() <= uh) self.assertTrue(ul <= Nu.simulation.inter_arrival_times[Nu.id_number][0]() <= uh) - # def test_error_uniform_dist(self): - # Arrival_distributions = [['Uniform', 2.2, 3.3]] - # Arrival_distributions_E = [['Uniform', -2.2, 3.3]] - # Arrival_distributions_EE = [['Uniform', 3.3, 2.2]] - # Service_distributions = [['Uniform', 2.2, 3.3]] - # Service_distributions_E = [['Uniform', 2.2, -3.3]] - # Service_distributions_EE = [['Uniform', 3.3, 2.2]] - # Number_of_servers = [1] - # Transition_matrices = [[0.1]] - # Simulation_time = 2222 - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions_E, - # 'Service_distributions':Service_distributions, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions_EE, - # 'Service_distributions':Service_distributions, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions, - # 'Service_distributions':Service_distributions_E, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions, - # 'Service_distributions':Service_distributions_EE, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) + def test_error_uniform_dist(self): + Arrival_distributions = [['Uniform', 2.2, 3.3]] + Arrival_distributions_E = [['Uniform', -2.2, 3.3]] + Arrival_distributions_EE = [['Uniform', 3.3, 2.2]] + Service_distributions = [['Uniform', 2.2, 3.3]] + Service_distributions_E = [['Uniform', 2.2, -3.3]] + Service_distributions_EE = [['Uniform', 3.3, 2.2]] + Number_of_servers = [1] + Transition_matrices = [[0.1]] + Simulation_time = 2222 + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions_E, + 'Service_distributions':Service_distributions, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions_EE, + 'Service_distributions':Service_distributions, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions, + 'Service_distributions':Service_distributions_E, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions, + 'Service_distributions':Service_distributions_EE, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) def test_sampling_deterministic_dist(self): params = { @@ -155,26 +151,24 @@ def test_sampling_deterministic_dist_hypothesis(self, d, rm): self.assertEqual(Nd.simulation.service_times[Nd.id_number][0](), d) self.assertEqual(Nd.simulation.inter_arrival_times[Nd.id_number][0](), d) - # def test_error_deterministic_dist(self): - # Arrival_distributions = [['Deterministic', 2.2]] - # Arrival_distributions_E = [['Deterministic', -2.2]] - # Service_distributions = [['Deterministic', 3.3]] - # Service_distributions_E = [['Deterministic', -3.3]] - # Number_of_servers = [1] - # Transition_matrices = [[0.1]] - # Simulation_time = 2222 - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions_E, - # 'Service_distributions':Service_distributions, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions, - # 'Service_distributions':Service_distributions_E, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) + def test_error_deterministic_dist(self): + Arrival_distributions = [['Deterministic', 2.2]] + Arrival_distributions_E = [['Deterministic', -2.2]] + Service_distributions = [['Deterministic', 3.3]] + Service_distributions_E = [['Deterministic', -3.3]] + Number_of_servers = [1] + Transition_matrices = [[0.1]] + Simulation_time = 2222 + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions_E, + 'Service_distributions':Service_distributions, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions, + 'Service_distributions':Service_distributions_E, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) def test_sampling_triangular_dist(self): params = { @@ -226,40 +220,36 @@ def test_sampling_triangular_dist_hypothesis(self, t, rm): self.assertTrue(tl <= Nt.simulation.service_times[Nt.id_number][0]() <= th) self.assertTrue(tl <= Nt.simulation.inter_arrival_times[Nt.id_number][0]() <= th) - # def test_error_triangular_dist(self): - # Arrival_distributions = [['Triangular', 2.2, 3.3, 2.8]] - # Arrival_distributions_E = [['Triangular', -2.2, 3.3, 2.8]] - # Arrival_distributions_EE = [['Triangular', 3.3, 2.2, 2.1]] - # Service_distributions = [['Triangular', 2.2, 3.3, 2.8]] - # Service_distributions_E = [['Triangular', 2.2, -3.3, 2.8]] - # Service_distributions_EE = [['Triangular', 2.2, 2.6, 2.9]] - # Number_of_servers = [1] - # Transition_matrices = [[0.1]] - # Simulation_time = 2222 - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions_E, - # 'Service_distributions':Service_distributions, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions_EE, - # 'Service_distributions':Service_distributions, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions, - # 'Service_distributions':Service_distributions_E, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions, - # 'Service_distributions':Service_distributions_EE, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) + def test_error_triangular_dist(self): + Arrival_distributions = [['Triangular', 2.2, 3.3, 2.8]] + Arrival_distributions_E = [['Triangular', -2.2, 3.3, 2.8]] + Arrival_distributions_EE = [['Triangular', 3.3, 2.2, 2.1]] + Service_distributions = [['Triangular', 2.2, 3.3, 2.8]] + Service_distributions_E = [['Triangular', 2.2, -3.3, 2.8]] + Service_distributions_EE = [['Triangular', 2.2, 2.6, 2.9]] + Number_of_servers = [1] + Transition_matrices = [[0.1]] + Simulation_time = 2222 + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions_E, + 'Service_distributions':Service_distributions, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions_EE, + 'Service_distributions':Service_distributions, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions, + 'Service_distributions':Service_distributions_E, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions, + 'Service_distributions':Service_distributions_EE, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) def test_sampling_exponential_dist(self): params = { @@ -502,28 +492,26 @@ def test_sampling_empirical_dist_hypothesis(self, dist, rm): self.assertTrue(Nem.simulation.inter_arrival_times[ Nem.id_number][0]() in set(my_empirical_dist)) - # def test_error_empirical_dist(self): - # my_empirical_dist = [8.0, 8.0, 8.0, 8.8, 8.8, 12.3] - # my_empirical_dist_E = [8.0, 8.0, 8.0, -8.8, 8.8, 12.3] - # Arrival_distributions = [['Empirical', my_empirical_dist]] - # Arrival_distributions_E = [['Empirical', my_empirical_dist_E]] - # Service_distributions = [['Empirical', my_empirical_dist]] - # Service_distributions_E = [['Empirical', my_empirical_dist_E]] - # Number_of_servers = [1] - # Transition_matrices = [[0.1]] - # Simulation_time = 2222 - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions': Arrival_distributions_E, - # 'Service_distributions': Service_distributions, - # 'Number_of_servers': Number_of_servers, - # 'Transition_matrices': Transition_matrices})) - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions': Arrival_distributions, - # 'Service_distributions': Service_distributions_E, - # 'Number_of_servers': Number_of_servers, - # 'Transition_matrices': Transition_matrices})) + def test_error_empirical_dist(self): + my_empirical_dist = [8.0, 8.0, 8.0, 8.8, 8.8, 12.3] + my_empirical_dist_E = [8.0, 8.0, 8.0, -8.8, 8.8, 12.3] + Arrival_distributions = [['Empirical', my_empirical_dist]] + Arrival_distributions_E = [['Empirical', my_empirical_dist_E]] + Service_distributions = [['Empirical', my_empirical_dist]] + Service_distributions_E = [['Empirical', my_empirical_dist_E]] + Number_of_servers = [1] + Transition_matrices = [[0.1]] + Simulation_time = 2222 + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions': Arrival_distributions_E, + 'Service_distributions': Service_distributions, + 'Number_of_servers': Number_of_servers, + 'Transition_matrices': Transition_matrices}) + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions': Arrival_distributions, + 'Service_distributions': Service_distributions_E, + 'Number_of_servers': Number_of_servers, + 'Transition_matrices': Transition_matrices}) def test_sampling_custom_dist(self): my_custom_dist = [[0.2, 3.7], [0.5, 3.8], [0.3, 4.1]] @@ -580,43 +568,39 @@ def test_sampling_custom_dist_hypothesis(self, custs, rm): self.assertTrue(Nc.simulation.inter_arrival_times[ Nc.id_number][0]() in set(cust_vals)) - # def test_error_custom_dist(self): - # my_custom_dist = [[0.2, 3.7], [0.5, 3.8], [0.3, 4.1]] - # my_custom_dist_E = [[0.2, 3.7], [0.5, -3.8], [0.3, 4.1]] - # my_custom_dist_EE = [[0.2, 3.7], [-0.5, 3.8], [0.3, 4.1]] - # Arrival_distributions = [['Custom', my_custom_dist]] - # Arrival_distributions_E = [['Custom', my_custom_dist_E]] - # Arrival_distributions_EE = [['Custom', my_custom_dist_EE]] - # Service_distributions = [['Custom', my_custom_dist]] - # Service_distributions_E = [['Custom', my_custom_dist_E]] - # Service_distributions_EE = [['Custom', my_custom_dist_EE]] - # Number_of_servers = [1] - # Transition_matrices = [[0.1]] - # Simulation_time = 2222 - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions_E, - # 'Service_distributions':Service_distributions, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions_EE, - # 'Service_distributions':Service_distributions, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions, - # 'Service_distributions':Service_distributions_E, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) - # self.assertRaises(ValueError, ciw.Simulation, - # ciw.Network_From_Dictionary( - # {'Arrival_distributions':Arrival_distributions, - # 'Service_distributions':Service_distributions_EE, - # 'Number_of_servers':Number_of_servers, - # 'Transition_matrices':Transition_matrices})) + def test_error_custom_dist(self): + my_custom_dist = [[0.2, 3.7], [0.5, 3.8], [0.3, 4.1]] + my_custom_dist_E = [[0.2, 3.7], [0.5, -3.8], [0.3, 4.1]] + my_custom_dist_EE = [[0.2, 3.7], [-0.5, 3.8], [0.3, 4.1]] + Arrival_distributions = [['Custom', my_custom_dist]] + Arrival_distributions_E = [['Custom', my_custom_dist_E]] + Arrival_distributions_EE = [['Custom', my_custom_dist_EE]] + Service_distributions = [['Custom', my_custom_dist]] + Service_distributions_E = [['Custom', my_custom_dist_E]] + Service_distributions_EE = [['Custom', my_custom_dist_EE]] + Number_of_servers = [1] + Transition_matrices = [[0.1]] + Simulation_time = 2222 + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions_E, + 'Service_distributions':Service_distributions, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions_EE, + 'Service_distributions':Service_distributions, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions, + 'Service_distributions':Service_distributions_E, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) + self.assertRaises(ValueError, ciw.Network_From_Dictionary, + {'Arrival_distributions':Arrival_distributions, + 'Service_distributions':Service_distributions_EE, + 'Number_of_servers':Number_of_servers, + 'Transition_matrices':Transition_matrices}) def test_sampling_function_dist(self): params = { @@ -711,19 +695,19 @@ def test_no_arrivals_dist(self): set_seed(5) self.assertEqual(Nna.simulation.inter_arrival_times[Nna.id_number][0](), 'Inf') - # def test_error_dist(self): - # params = {'Arrival_distributions': ['NoArrivals'], - # 'Service_distributions': [['dlkjdlksj', 9]], - # 'Number_of_servers': [1], - # 'Transition_matrices': [[0.1]], - # 'Simulation_time': 2222} - # self.assertRaises(ValueError, ciw.Simulation, ciw.Network_From_Dictionary(params)) - # params = {'Arrival_distributions': [['skjfhkjsfhjk']], - # 'Service_distributions': [['Exponential', 9.5]], - # 'Number_of_servers': [1], - # 'Transition_matrices': [[0.1]], - # 'Simulation_time': 2222} - # self.assertRaises(ValueError, ciw.Simulation, ciw.Network_From_Dictionary(params)) + def test_error_dist(self): + params = {'Arrival_distributions': ['NoArrivals'], + 'Service_distributions': [['dlkjdlksj', 9]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]], + 'Simulation_time': 2222} + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params) + params = {'Arrival_distributions': [['skjfhkjsfhjk']], + 'Service_distributions': [['Exponential', 9.5]], + 'Number_of_servers': [1], + 'Transition_matrices': [[0.1]], + 'Simulation_time': 2222} + self.assertRaises(ValueError, ciw.Network_From_Dictionary, params) @given(positive_float=floats(min_value=0.0, max_value=100.0), negative_float=floats(min_value=-100.0, max_value=0.0), diff --git a/ciw/tests/test_simulation.py b/ciw/tests/test_simulation.py index 20869664..31c01727 100644 --- a/ciw/tests/test_simulation.py +++ b/ciw/tests/test_simulation.py @@ -4,7 +4,6 @@ from hypothesis import given from hypothesis.strategies import floats, integers, lists, random_module import os -import copy from numpy import random as nprandom from decimal import Decimal import networkx as nx @@ -174,76 +173,6 @@ def test_mminf_node(self, arrival_rate, service_rate, rm): waits = [ind.data_records[1][0].wait for ind in inds] self.assertEqual(sum(waits), 0.0) - # def test_raising_errors(self): - # params = {'Arrival_distributions': {'Class 0':[['Exponential', 3.0]]}, - # 'Service_distributions': {'Class 0':[['Exponential', 7.0]]}, - # 'Number_of_servers': [9], - # 'Number_of_classes': 1, - # 'Transition_matrices': {'Class 0': [[0.5]]}, - # 'Number_of_nodes': 1, - # 'Queue_capacities': ['Inf'], - # 'Detect_deadlock': False} - # params_list = [copy.deepcopy(params) for i in range(28)] - - # params_list[0]['Number_of_classes'] = -2 - # self.assertRaises(ValueError, ciw.Simulation, params_list[0]) - # params_list[1]['Number_of_nodes'] = -2 - # self.assertRaises(ValueError, ciw.Simulation, params_list[1]) - # params_list[2]['Number_of_servers'] = [5, 6, 7] - # self.assertRaises(ValueError, ciw.Simulation, params_list[2]) - # params_list[3]['Number_of_servers'] = [-3] - # self.assertRaises(ValueError, ciw.Simulation, params_list[3]) - # params_list[4]['Number_of_servers'] = ['my_missing_schedule'] - # self.assertRaises(ValueError, ciw.Simulation, params_list[4]) - # params_list[5]['Detect_deadlock'] = 'No' - # self.assertRaises(ValueError, ciw.Simulation, params_list[5]) - # params_list[6]['Queue_capacities'] = ['Inf', 1, 2] - # self.assertRaises(ValueError, ciw.Simulation, params_list[6]) - # params_list[7]['Queue_capacities'] = [-2] - # self.assertRaises(ValueError, ciw.Simulation, params_list[7]) - # params_list[8]['Arrival_distributions'] = {'Class 0':[['Exponential', 3.2]], - # 'Class 1':[['Exponential', 2.1]]} - # self.assertRaises(ValueError, ciw.Simulation, params_list[8]) - # params_list[9]['Arrival_distributions'] = {'Patient 0':[['Exponential', 11.5]]} - # self.assertRaises(ValueError, ciw.Simulation, params_list[9]) - # params_list[10]['Arrival_distributions']['Class 0'] = [['Exponential', 3.1], - # ['Exponential', 2.4]] - # self.assertRaises(ValueError, ciw.Simulation, params_list[10]) - # params_list[11]['Service_distributions'] = {'Class 0':[['Exponential', 3.2]], - # 'Class 1':[['Exponential', 2.1]]} - # self.assertRaises(ValueError, ciw.Simulation, params_list[11]) - # params_list[12]['Service_distributions'] = {'Patient 0':[['Exponential', 11.5]]} - # self.assertRaises(ValueError, ciw.Simulation, params_list[12]) - # params_list[13]['Service_distributions']['Class 0'] = [['Exponential', 3.1], - # ['Exponential', 2.4]] - # self.assertRaises(ValueError, ciw.Simulation, params_list[13]) - # params_list[14]['Transition_matrices'] = {'Class 0':[[0.2]], - # 'Class 1':[[0.3]]} - # self.assertRaises(ValueError, ciw.Simulation, params_list[14]) - # params_list[15]['Transition_matrices'] = {'Patient 0':[[0.5]]} - # self.assertRaises(ValueError, ciw.Simulation, params_list[15]) - # params_list[16]['Transition_matrices']['Class 0'] = [[0.2], [0.1]] - # self.assertRaises(ValueError, ciw.Simulation, params_list[16]) - # params_list[17]['Transition_matrices']['Class 0'] = [[0.2, 0.1]] - # self.assertRaises(ValueError, ciw.Simulation, params_list[17]) - # params_list[18]['Transition_matrices']['Class 0'] = [[-0.6]] - # self.assertRaises(ValueError, ciw.Simulation, params_list[18]) - # params_list[19]['Transition_matrices']['Class 0'] = [[1.4]] - # self.assertRaises(ValueError, ciw.Simulation, params_list[19]) - # params_list[22]['Class_change_matrices'] = {'Node 0':[[0.0]], - # 'Node 1':[[0.0]]} - # self.assertRaises(ValueError, ciw.Simulation, params_list[22]) - # params_list[23]['Class_change_matrices'] = {'Patient 0':[[0.0]]} - # self.assertRaises(ValueError, ciw.Simulation, params_list[23]) - # params_list[24]['Class_change_matrices'] = {'Node 0':[[0.1], [0.2]]} - # self.assertRaises(ValueError, ciw.Simulation, params_list[24]) - # params_list[25]['Class_change_matrices'] = {'Node 0':[[0.0, 0.3]]} - # self.assertRaises(ValueError, ciw.Simulation, params_list[25]) - # params_list[26]['Class_change_matrices'] = {'Node 0':[[-0.4]]} - # self.assertRaises(ValueError, ciw.Simulation, params_list[26]) - # params_list[27]['Class_change_matrices'] = {'Node 0':[[1.5]]} - # self.assertRaises(ValueError, ciw.Simulation, params_list[27]) - def test_writing_data_files(self): Q = ciw.Simulation(ciw.Network_From_File( 'ciw/tests/testing_parameters/params.yml')) From 93a2d4353f32c8821258e4eb99cdf0e60390a2a7 Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Wed, 20 Apr 2016 17:20:01 +0100 Subject: [PATCH 17/20] rename helper functions --- ciw/import_params.py | 34 +++++++++----- ciw/tests/test_arrival_node.py | 16 +++---- ciw/tests/test_network.py | 58 ++++++++++++------------ ciw/tests/test_node.py | 48 ++++++++++---------- ciw/tests/test_sampling.py | 80 ++++++++++++++++----------------- ciw/tests/test_server.py | 4 +- ciw/tests/test_simulation.py | 40 ++++++++--------- ciw/tests/test_state_tracker.py | 48 ++++++++++---------- 8 files changed, 170 insertions(+), 158 deletions(-) diff --git a/ciw/import_params.py b/ciw/import_params.py index 16712ce0..7b43fc7e 100644 --- a/ciw/import_params.py +++ b/ciw/import_params.py @@ -3,6 +3,18 @@ from network import * +def create_network(params): + """ + Identifies the type of parameters that is input and calls the correct function + """ + if isinstance(params, dict): + return create_network_from_dictionary(params) + if isinstance(params, str): + if params[-4:] == '.yml': + return create_network_from_yml(params) + return None + + def load_parameters(directory_name): """ Loads the parameters into the model @@ -16,7 +28,17 @@ def load_parameters(directory_name): return parameters -def Network_From_Dictionary(params): +def create_network_from_yml(directory_name): + """ + Creates a Network object form a yaml file + """ + params = load_parameters(directory_name) + fill_out_dictionary(params) + validify_dictionary(params) + return create_network_from_dictionary(params) + + +def create_network_from_dictionary(params): """ Creates a Network object from a parameters dictionary """ @@ -56,16 +78,6 @@ def Network_From_Dictionary(params): return Network(nodes, classes) -def Network_From_File(directory_name): - """ - Creates a Network object form a yaml file - """ - params = load_parameters(directory_name) - fill_out_dictionary(params) - validify_dictionary(params) - return Network_From_Dictionary(params) - - def fill_out_dictionary(params): """ Fills out the parameters dictionary with the diff --git a/ciw/tests/test_arrival_node.py b/ciw/tests/test_arrival_node.py index 41f222a6..e80c2aad 100644 --- a/ciw/tests/test_arrival_node.py +++ b/ciw/tests/test_arrival_node.py @@ -13,7 +13,7 @@ class TestArrivalNode(unittest.TestCase): def test_init_method(self): set_seed(5) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual(round(N.next_event_date, 5), 0.00440) @@ -28,7 +28,7 @@ def test_init_method(self): def test_initialise_event_dates_dict_method(self): set_seed(6) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) dates_dict_1 = {1: {0: 0.4362282541, 1: 0.2672232406, 2: 0.3864256273}, @@ -48,14 +48,14 @@ def test_initialise_event_dates_dict_method(self): dates_dict_2) def test_repr_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual(str(N), 'Arrival Node') def test_find_next_event_date_method(self): set_seed(1) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual(round(N.next_event_date, 5), 0.00105) @@ -71,7 +71,7 @@ def test_find_next_event_date_method(self): def test_have_event_method(self): set_seed(1) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual([str(obj) for obj in Q.transitive_nodes[0].individuals], []) @@ -90,7 +90,7 @@ def test_have_event_method(self): self.assertEqual(N.next_node, 3) set_seed(12) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = ciw.ArrivalNode(Q) self.assertEqual([str(obj) for obj in Q.transitive_nodes[0].individuals], []) @@ -115,7 +115,7 @@ def test_no_arrivals_example(self): ['Exponential', 1.0], ['Exponential', 4.0], ['Exponential', 3.5]] - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) AN = Q.nodes[0] self.assertEqual(AN.simulation.network.customer_classes[0].arrival_distributions[0], 'NoArrivals') self.assertEqual(AN.inter_arrival(1, 0), 'Inf') @@ -126,7 +126,7 @@ def test_rejection_dict(self): 'Transition_matrices':[[0.0, 1.0], [0.0, 0.0]], 'Number_of_servers':[1, 1], 'Queue_capacities':[1, 1]} - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) self.assertEqual(Q.rejection_dict, {1: {0: []}, 2: {0:[]}}) Q.simulate_until_max_time(20) self.assertEqual(Q.rejection_dict, {1: {0: [9.0, 12.0, 18.0]}, 2: {0:[12.0, 16.0]}}) diff --git a/ciw/tests/test_network.py b/ciw/tests/test_network.py index dd88afc4..58a504de 100644 --- a/ciw/tests/test_network.py +++ b/ciw/tests/test_network.py @@ -80,7 +80,7 @@ def test_init_method(self): self.assertEqual(N.number_of_classes, 2) - def test_network_from_dictionary(self): + def test_create_network_from_dictionary(self): params = {'Arrival_distributions': {'Class 0': [['Exponential', 3.0]]}, 'Service_distributions': {'Class 0': [['Exponential', 7.0]]}, 'Number_of_servers': [9], @@ -88,7 +88,7 @@ def test_network_from_dictionary(self): 'Transition_matrices': {'Class 0': [[0.5]]}, 'Number_of_nodes': 1, 'Queue_capacities': ['Inf']} - N = ciw.Network_From_Dictionary(params) + N = ciw.create_network_from_dictionary(params) self.assertEqual(N.number_of_nodes, 1) self.assertEqual(N.number_of_classes, 1) @@ -111,7 +111,7 @@ def test_network_from_dictionary(self): 'Queue_capacities': [10, 'Inf'], 'my_amazing_schedule': [[20, 1], [50, 4]]} - N = ciw.Network_From_Dictionary(params) + N = ciw.create_network_from_dictionary(params) self.assertEqual(N.number_of_nodes, 2) self.assertEqual(N.number_of_classes, 1) self.assertEqual(N.service_centres[0].queueing_capacity, 10) @@ -138,7 +138,7 @@ def test_network_from_dictionary(self): 'Queue_capacities': ['Inf'], 'Class_change_matrices': {'Node 1': [[0.0, 1.0], [0.2, 0.8]]}} - N = ciw.Network_From_Dictionary(params) + N = ciw.create_network_from_dictionary(params) self.assertEqual(N.number_of_nodes, 1) self.assertEqual(N.number_of_classes, 2) self.assertEqual(N.service_centres[0].queueing_capacity, 'Inf') @@ -153,8 +153,8 @@ def test_network_from_dictionary(self): self.assertEqual(N.customer_classes[1].transition_matrix, [[0.0]]) - def test_network_from_file(self): - N = ciw.Network_From_File( + def test_create_network_from_yml(self): + N = ciw.create_network_from_yml( 'ciw/tests/testing_parameters/params.yml') self.assertEqual(N.number_of_nodes, 4) self.assertEqual(N.number_of_classes, 3) @@ -196,55 +196,55 @@ def test_raising_errors(self): params_list = [copy.deepcopy(params) for i in range(23)] params_list[0]['Number_of_classes'] = -2 - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[0]) + self.assertRaises(ValueError, ciw.create_network, params_list[0]) params_list[1]['Number_of_nodes'] = -2 - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[1]) + self.assertRaises(ValueError, ciw.create_network, params_list[1]) params_list[2]['Number_of_servers'] = [5, 6, 7] - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[2]) + self.assertRaises(ValueError, ciw.create_network, params_list[2]) params_list[3]['Number_of_servers'] = [-3] - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[3]) + self.assertRaises(ValueError, ciw.create_network, params_list[3]) params_list[4]['Number_of_servers'] = ['my_missing_schedule'] - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[4]) + self.assertRaises(ValueError, ciw.create_network, params_list[4]) params_list[5]['Queue_capacities'] = ['Inf', 1, 2] - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[5]) + self.assertRaises(ValueError, ciw.create_network, params_list[5]) params_list[6]['Queue_capacities'] = [-2] - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[6]) + self.assertRaises(ValueError, ciw.create_network, params_list[6]) params_list[7]['Arrival_distributions'] = {'Class 0':[['Exponential', 3.2]], 'Class 1':[['Exponential', 2.1]]} - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[7]) + self.assertRaises(ValueError, ciw.create_network, params_list[7]) params_list[8]['Arrival_distributions'] = {'Patient 0':[['Exponential', 11.5]]} - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[8]) + self.assertRaises(ValueError, ciw.create_network, params_list[8]) params_list[9]['Arrival_distributions']['Class 0'] = [['Exponential', 3.1], ['Exponential', 2.4]] - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[9]) + self.assertRaises(ValueError, ciw.create_network, params_list[9]) params_list[10]['Service_distributions'] = {'Class 0':[['Exponential', 3.2]], 'Class 1':[['Exponential', 2.1]]} - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[10]) + self.assertRaises(ValueError, ciw.create_network, params_list[10]) params_list[11]['Service_distributions'] = {'Patient 0':[['Exponential', 11.5]]} - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[11]) + self.assertRaises(ValueError, ciw.create_network, params_list[11]) params_list[12]['Service_distributions']['Class 0'] = [['Exponential', 3.1], ['Exponential', 2.4]] - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[12]) + self.assertRaises(ValueError, ciw.create_network, params_list[12]) params_list[13]['Transition_matrices'] = {'Class 0':[[0.2]], 'Class 1':[[0.3]]} - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[13]) + self.assertRaises(ValueError, ciw.create_network, params_list[13]) params_list[14]['Transition_matrices'] = {'Patient 0':[[0.5]]} - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[14]) + self.assertRaises(ValueError, ciw.create_network, params_list[14]) params_list[15]['Transition_matrices']['Class 0'] = [[0.2], [0.1]] - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[15]) + self.assertRaises(ValueError, ciw.create_network, params_list[15]) params_list[16]['Transition_matrices']['Class 0'] = [[0.2, 0.1]] - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[16]) + self.assertRaises(ValueError, ciw.create_network, params_list[16]) params_list[17]['Transition_matrices']['Class 0'] = [[-0.6]] - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[17]) + self.assertRaises(ValueError, ciw.create_network, params_list[17]) params_list[18]['Transition_matrices']['Class 0'] = [[1.4]] - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[18]) + self.assertRaises(ValueError, ciw.create_network, params_list[18]) params_list[19]['Class_change_matrices'] = {'Node 1':[[0.0]], 'Node 2':[[0.0]]} - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[19]) + self.assertRaises(ValueError, ciw.create_network, params_list[19]) params_list[20]['Class_change_matrices'] = {'Patient 0':[[0.0]]} - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[20]) + self.assertRaises(ValueError, ciw.create_network, params_list[20]) params_list[21]['Class_change_matrices'] = {'Node 1':[[-0.4]]} - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[21]) + self.assertRaises(ValueError, ciw.create_network, params_list[21]) params_list[22]['Class_change_matrices'] = {'Node 1':[[1.5]]} - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params_list[22]) + self.assertRaises(ValueError, ciw.create_network, params_list[22]) diff --git a/ciw/tests/test_node.py b/ciw/tests/test_node.py index 4549e36b..13681421 100644 --- a/ciw/tests/test_node.py +++ b/ciw/tests/test_node.py @@ -12,7 +12,7 @@ def set_seed(x): class TestNode(unittest.TestCase): def test_init_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = ciw.Node(1, Q) self.assertEqual(N.c, 9) @@ -23,7 +23,7 @@ def test_init_method(self): self.assertEqual(N.individuals, []) self.assertEqual(N.id_number, 1) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_change_class.yml')) N1 = Q.transitive_nodes[0] self.assertEqual(N1.class_change, [[0.5, 0.5], @@ -31,7 +31,7 @@ def test_init_method(self): N2 = Q.transitive_nodes[1] self.assertEqual(N2.class_change, [[1.0, 0.0], [0.0, 1.0]]) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] self.assertEqual(N.cyclelength, 100) @@ -40,7 +40,7 @@ def test_init_method(self): self.assertEqual(N.next_event_date, 30) def test_repr_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N1 = ciw.Node(1, Q) N2 = ciw.Node(2, Q) @@ -48,7 +48,7 @@ def test_repr_method(self): self.assertEqual(str(N2), 'Node 2') def test_change_shift_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] N.next_event_date = 30 @@ -79,7 +79,7 @@ def test_change_shift_method(self): self.assertEqual(N.c, 3) def test_take_servers_off_duty_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] N.add_new_servers(3) @@ -101,7 +101,7 @@ def test_take_servers_off_duty_method(self): self.assertEqual([obs.offduty for obs in N.servers], [True, True]) def test_check_if_shiftchange_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] N.next_event_date = 12.0 @@ -109,7 +109,7 @@ def test_check_if_shiftchange_method(self): N.next_event_date = 30.0 self.assertEqual(N.check_if_shiftchange(), True) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] N.next_event_date = 12.0 @@ -119,7 +119,7 @@ def test_check_if_shiftchange_method(self): def test_finish_service_method(self): set_seed(4) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] inds = [ciw.Individual(i + 1) for i in xrange(3)] @@ -135,7 +135,7 @@ def test_finish_service_method(self): def test_change_customer_class_method(self): set_seed(14) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_change_class.yml')) N1 = Q.transitive_nodes[0] ind = ciw.Individual(254, 0) @@ -156,7 +156,7 @@ def test_change_customer_class_method(self): def test_block_individual_method(self): set_seed(4) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_deadlock.yml'), deadlock_detector='StateDigraph') inds = [ciw.Individual(i + 1) for i in xrange(7)] @@ -179,7 +179,7 @@ def test_block_individual_method(self): def test_release_method(self): set_seed(4) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] inds = [ciw.Individual(i+1) for i in xrange(3)] @@ -200,7 +200,7 @@ def test_release_method(self): def test_begin_service_if_possible_release_method(self): set_seed(50) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_deadlock.yml'), deadlock_detector='StateDigraph') inds = [ciw.Individual(i) for i in xrange(30)] @@ -230,7 +230,7 @@ def test_begin_service_if_possible_release_method(self): self.assertEqual(round(ind.service_end_date, 5), 203.14) def test_release_blocked_individual_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_deadlock.yml'), deadlock_detector='StateDigraph') N1 = Q.transitive_nodes[0] @@ -308,7 +308,7 @@ def test_release_blocked_individual_method(self): def test_accept_method(self): set_seed(6) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] N.next_event_date = 0.0 @@ -368,7 +368,7 @@ def test_accept_method(self): def test_begin_service_if_possible_accept_method(self): set_seed(50) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_deadlock.yml'), deadlock_detector='StateDigraph') ind = ciw.Individual(1) @@ -394,7 +394,7 @@ def test_begin_service_if_possible_accept_method(self): self.assertEqual(round(ind.service_end_date, 5), 300.03382) def test_kill_server_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] s = N.servers[0] @@ -418,7 +418,7 @@ def test_kill_server_method(self): ['Server 3 at Node 1']) def test_add_new_servers_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] self.assertEqual([str(obs) for obs in N.servers], @@ -432,7 +432,7 @@ def test_add_new_servers_method(self): 'Server 4 at Node 1']) def test_update_next_event_date_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] self.assertEqual(N.next_event_date, 'Inf') @@ -465,7 +465,7 @@ def test_update_next_event_date_method(self): self.assertEqual(N.next_event_date, 'Inf') - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_schedule.yml')) N = Q.transitive_nodes[0] self.assertEqual(N.next_event_date, 30) @@ -487,7 +487,7 @@ def test_update_next_event_date_method(self): def test_next_node_method(self): set_seed(6) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) node = Q.transitive_nodes[0] self.assertEqual(str(node.next_node(0)), 'Exit Node') @@ -498,7 +498,7 @@ def test_next_node_method(self): self.assertEqual(str(node.next_node(0)), 'Node 4') set_seed(54) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) node = Q.transitive_nodes[2] self.assertEqual(str(node.next_node(0)), 'Node 2') @@ -512,7 +512,7 @@ def test_next_node_method(self): def test_write_individual_record_method(self): set_seed(7) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] ind = ciw.Individual(6) @@ -530,7 +530,7 @@ def test_write_individual_record_method(self): self.assertEqual(ind.data_records[1][0].customer_class, 0) def test_date_from_schedule_generator(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) sg = Q.nodes[1].date_from_schedule_generator([30, 60, 90, 100]) diff --git a/ciw/tests/test_sampling.py b/ciw/tests/test_sampling.py index d1b24011..76ff7b90 100644 --- a/ciw/tests/test_sampling.py +++ b/ciw/tests/test_sampling.py @@ -31,7 +31,7 @@ def test_sampling_uniform_dist(self): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nu = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -68,7 +68,7 @@ def test_sampling_uniform_dist_hypothesis(self, u, rm): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nu = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(ul <= Nu.simulation.service_times[Nu.id_number][0]() <= uh) @@ -84,22 +84,22 @@ def test_error_uniform_dist(self): Number_of_servers = [1] Transition_matrices = [[0.1]] Simulation_time = 2222 - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions_E, 'Service_distributions':Service_distributions, 'Number_of_servers':Number_of_servers, 'Transition_matrices':Transition_matrices}) - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions_EE, 'Service_distributions':Service_distributions, 'Number_of_servers':Number_of_servers, 'Transition_matrices':Transition_matrices}) - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions, 'Service_distributions':Service_distributions_E, 'Number_of_servers':Number_of_servers, 'Transition_matrices':Transition_matrices}) - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions, 'Service_distributions':Service_distributions_EE, 'Number_of_servers':Number_of_servers, @@ -112,7 +112,7 @@ def test_sampling_deterministic_dist(self): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nd = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -145,7 +145,7 @@ def test_sampling_deterministic_dist_hypothesis(self, d, rm): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nd = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertEqual(Nd.simulation.service_times[Nd.id_number][0](), d) @@ -159,12 +159,12 @@ def test_error_deterministic_dist(self): Number_of_servers = [1] Transition_matrices = [[0.1]] Simulation_time = 2222 - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions_E, 'Service_distributions':Service_distributions, 'Number_of_servers':Number_of_servers, 'Transition_matrices':Transition_matrices}) - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions, 'Service_distributions':Service_distributions_E, 'Number_of_servers':Number_of_servers, @@ -177,7 +177,7 @@ def test_sampling_triangular_dist(self): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nt = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -214,7 +214,7 @@ def test_sampling_triangular_dist_hypothesis(self, t, rm): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nt = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(tl <= Nt.simulation.service_times[Nt.id_number][0]() <= th) @@ -230,22 +230,22 @@ def test_error_triangular_dist(self): Number_of_servers = [1] Transition_matrices = [[0.1]] Simulation_time = 2222 - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions_E, 'Service_distributions':Service_distributions, 'Number_of_servers':Number_of_servers, 'Transition_matrices':Transition_matrices}) - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions_EE, 'Service_distributions':Service_distributions, 'Number_of_servers':Number_of_servers, 'Transition_matrices':Transition_matrices}) - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions, 'Service_distributions':Service_distributions_E, 'Number_of_servers':Number_of_servers, 'Transition_matrices':Transition_matrices}) - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions, 'Service_distributions':Service_distributions_EE, 'Number_of_servers':Number_of_servers, @@ -258,7 +258,7 @@ def test_sampling_exponential_dist(self): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Ne = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -291,7 +291,7 @@ def test_sampling_exponential_dist_hypothesis(self, e, rm): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Ne = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(Ne.simulation.service_times[Ne.id_number][0]() >= 0.0) @@ -304,7 +304,7 @@ def test_sampling_gamma_dist(self): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Ng = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -338,7 +338,7 @@ def test_sampling_gamma_dist_hypothesis(self, ga, gb, rm): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Ng = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(Ng.simulation.service_times[Ng.id_number][0]() >= 0.0) @@ -351,7 +351,7 @@ def test_sampling_lognormal_dist(self): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nl = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -385,7 +385,7 @@ def test_sampling_lognormal_dist_hypothesis(self, lm, lsd, rm): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nl = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(Nl.simulation.service_times[Nl.id_number][0]() >= 0.0) @@ -398,7 +398,7 @@ def test_sampling_weibull_dist(self): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nw = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -432,7 +432,7 @@ def test_sampling_weibull_dist_hypothesis(self, wa, wb, rm): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nw = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(Nw.simulation.service_times[Nw.id_number][0]() >= 0.0) @@ -447,7 +447,7 @@ def test_sampling_empirical_dist(self): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nem = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -484,7 +484,7 @@ def test_sampling_empirical_dist_hypothesis(self, dist, rm): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nem = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(Nem.simulation.service_times[ @@ -502,12 +502,12 @@ def test_error_empirical_dist(self): Number_of_servers = [1] Transition_matrices = [[0.1]] Simulation_time = 2222 - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions': Arrival_distributions_E, 'Service_distributions': Service_distributions, 'Number_of_servers': Number_of_servers, 'Transition_matrices': Transition_matrices}) - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions': Arrival_distributions, 'Service_distributions': Service_distributions_E, 'Number_of_servers': Number_of_servers, @@ -521,7 +521,7 @@ def test_sampling_custom_dist(self): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nc = Q.transitive_nodes[0] set_seed(5) self.assertEqual(round( @@ -560,7 +560,7 @@ def test_sampling_custom_dist_hypothesis(self, custs, rm): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nc = Q.transitive_nodes[0] for itr in xrange(10): # Because repition happens in the simulation self.assertTrue(Nc.simulation.service_times[ @@ -581,22 +581,22 @@ def test_error_custom_dist(self): Number_of_servers = [1] Transition_matrices = [[0.1]] Simulation_time = 2222 - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions_E, 'Service_distributions':Service_distributions, 'Number_of_servers':Number_of_servers, 'Transition_matrices':Transition_matrices}) - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions_EE, 'Service_distributions':Service_distributions, 'Number_of_servers':Number_of_servers, 'Transition_matrices':Transition_matrices}) - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions, 'Service_distributions':Service_distributions_E, 'Number_of_servers':Number_of_servers, 'Transition_matrices':Transition_matrices}) - self.assertRaises(ValueError, ciw.Network_From_Dictionary, + self.assertRaises(ValueError, ciw.create_network, {'Arrival_distributions':Arrival_distributions, 'Service_distributions':Service_distributions_EE, 'Number_of_servers':Number_of_servers, @@ -612,7 +612,7 @@ def test_sampling_function_dist(self): 'Transition_matrices': [[0.1, 0.1], [0.1, 0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) N1 = Q.transitive_nodes[0] N2 = Q.transitive_nodes[1] set_seed(5) @@ -672,7 +672,7 @@ def test_sampling_function_dist_hypothesis(self, const, dist, rm): 'Transition_matrices': [[0.1, 0.1], [0.1, 0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) N1 = Q.transitive_nodes[0] N2 = Q.transitive_nodes[1] set_seed(5) @@ -690,7 +690,7 @@ def test_no_arrivals_dist(self): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]] } - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Nna = Q.transitive_nodes[0] set_seed(5) self.assertEqual(Nna.simulation.inter_arrival_times[Nna.id_number][0](), 'Inf') @@ -701,13 +701,13 @@ def test_error_dist(self): 'Number_of_servers': [1], 'Transition_matrices': [[0.1]], 'Simulation_time': 2222} - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params) + self.assertRaises(ValueError, ciw.create_network, params) params = {'Arrival_distributions': [['skjfhkjsfhjk']], 'Service_distributions': [['Exponential', 9.5]], 'Number_of_servers': [1], 'Transition_matrices': [[0.1]], 'Simulation_time': 2222} - self.assertRaises(ValueError, ciw.Network_From_Dictionary, params) + self.assertRaises(ValueError, ciw.create_network, params) @given(positive_float=floats(min_value=0.0, max_value=100.0), negative_float=floats(min_value=-100.0, max_value=0.0), @@ -715,7 +715,7 @@ def test_error_dist(self): rm=random_module()) def test_check_userdef_dist(self, positive_float, negative_float, word, rm): assume(negative_float < 0) - Q = ciw.Simulation(ciw.Network_From_File('ciw/tests/testing_parameters/params.yml')) + Q = ciw.Simulation(ciw.create_network('ciw/tests/testing_parameters/params.yml')) self.assertEqual(Q.check_userdef_dist(lambda : positive_float), positive_float) self.assertRaises(ValueError, Q.check_userdef_dist, lambda : negative_float) self.assertRaises(ValueError, Q.check_userdef_dist, lambda : word) diff --git a/ciw/tests/test_server.py b/ciw/tests/test_server.py index c82defff..253dd28e 100644 --- a/ciw/tests/test_server.py +++ b/ciw/tests/test_server.py @@ -6,7 +6,7 @@ class TestServer(unittest.TestCase): def test_init_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[1] s = ciw.Server(N, 3) @@ -18,7 +18,7 @@ def test_init_method(self): self.assertEqual(s.offduty, False) def test_repr_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) N = Q.transitive_nodes[0] s = ciw.Server(N, 4) diff --git a/ciw/tests/test_simulation.py b/ciw/tests/test_simulation.py index 31c01727..75fc6fca 100644 --- a/ciw/tests/test_simulation.py +++ b/ciw/tests/test_simulation.py @@ -15,18 +15,18 @@ def set_seed(x): class TestSimulation(unittest.TestCase): def test_repr_method(self): - N1 = ciw.Network_From_File( + N1 = ciw.create_network( 'ciw/tests/testing_parameters/params.yml') Q1 = ciw.Simulation(N1) self.assertEqual(str(Q1), 'Simulation') - N2 = ciw.Network_From_File( + N2 = ciw.create_network( 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(N2, name='My special simulation instance!') self.assertEqual(str(Q), 'My special simulation instance!') def test_init_method(self): - N = ciw.Network_From_File( + N = ciw.create_network( 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(N) @@ -56,7 +56,7 @@ def test_init_method_h(self, 'Number_of_servers': [number_of_servers], 'Transition_matrices': [[0.0]]} - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) self.assertEqual(len(Q.transitive_nodes), 1) self.assertEqual(len(Q.nodes), 3) @@ -72,7 +72,7 @@ def test_init_method_h(self, ['Arrival Node', 'Node 1', 'Exit Node']) def test_find_next_active_node_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) i = 0 for node in Q.nodes[:-1]: @@ -80,7 +80,7 @@ def test_find_next_active_node_method(self): i += 1 self.assertEqual(str(Q.find_next_active_node()), 'Arrival Node') - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) i = 10 for node in Q.nodes[:-1]: @@ -90,7 +90,7 @@ def test_find_next_active_node_method(self): def test_simulate_until_max_time_method(self): set_seed(2) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) Q.simulate_until_max_time(150) L = Q.get_all_individuals() @@ -98,7 +98,7 @@ def test_simulate_until_max_time_method(self): L[300].data_records.values()[0][0].service_start_date, 8), 8.89002862) set_seed(60) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_change_class.yml')) Q.simulate_until_max_time(50) L = Q.get_all_individuals() @@ -109,14 +109,14 @@ def test_simulate_until_max_time_method(self): def test_simulate_until_deadlock_method(self): set_seed(3) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_deadlock.yml'), deadlock_detector='StateDigraph') Q.simulate_until_deadlock() self.assertEqual(round(Q.times_to_deadlock[((0, 0), (0, 0))], 8), 31.26985409) def test_detect_deadlock_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_deadlock.yml'), deadlock_detector='StateDigraph') nodes = ['A', 'B', 'C', 'D', 'E'] @@ -128,7 +128,7 @@ def test_detect_deadlock_method(self): Q.deadlock_detector.statedigraph.add_edge(cnctn[0], cnctn[1]) self.assertEqual(Q.deadlock_detector.detect_deadlock(), True) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_deadlock.yml'), deadlock_detector='StateDigraph') nodes = ['A', 'B', 'C', 'D'] @@ -140,7 +140,7 @@ def test_detect_deadlock_method(self): Q.deadlock_detector.statedigraph.add_edge(cnctn[0], cnctn[1]) self.assertEqual(Q.deadlock_detector.detect_deadlock(), False) - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_deadlock.yml'), deadlock_detector='StateDigraph') nodes = ['A', 'B'] @@ -154,7 +154,7 @@ def test_detect_deadlock_method(self): self.assertEqual(Q.deadlock_detector.detect_deadlock(), True) def test_mm1_from_file(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_mm1.yml')) self.assertEqual(Q.nodes[1].transition_row, [[0.0]]) @@ -167,14 +167,14 @@ def test_mminf_node(self, arrival_rate, service_rate, rm): 'Number_of_servers': ['Inf'], 'Transition_matrices': [[0.0]]} - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Q.simulate_until_max_time(5) inds = Q.get_all_individuals() waits = [ind.data_records[1][0].wait for ind in inds] self.assertEqual(sum(waits), 0.0) def test_writing_data_files(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) Q.simulate_until_max_time(50) files = [x for x in os.walk( @@ -187,7 +187,7 @@ def test_writing_data_files(self): self.assertEqual('data.csv' in files, True) os.remove('ciw/tests/testing_parameters/data.csv') - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params_mm1.yml')) Q.simulate_until_max_time(50) files = [x for x in os.walk( @@ -210,7 +210,7 @@ def test_simultaneous_events_example(self): 'Service_distributions': [['Deterministic', 5.0], ['Deterministic', 5.0]], 'Transition_matrices': [[1.0, 0.0], [0.0, 0.0]], 'Number_of_servers': [2, 1]} - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Q.simulate_until_max_time(36) inds = Q.get_all_individuals() recs = Q.get_all_records() @@ -223,7 +223,7 @@ def test_simultaneous_events_example(self): 'Service_distributions': [['Deterministic', 5.0], ['Deterministic', 5.0]], 'Transition_matrices': [[1.0, 0.0], [0.0, 0.0]], 'Number_of_servers': [2, 1]} - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Q.simulate_until_max_time(36) inds = Q.get_all_individuals() recs = Q.get_all_records() @@ -237,7 +237,7 @@ def test_exactness(self): 'Transition_matrices': [[0.0]], 'Number_of_servers': ['server_schedule'], 'server_schedule': [[0.5, 0], [0.55, 1], [3.0, 0]]} - Q = ciw.Simulation(ciw.Network_From_Dictionary(params)) + Q = ciw.Simulation(ciw.create_network(params)) Q.simulate_until_max_time(10) recs = Q.get_all_records(headers=False) mod_service_starts = [obs%3 for obs in [r[5] for r in recs]] @@ -249,7 +249,7 @@ def test_exactness(self): 'Transition_matrices': [[0.0]], 'Number_of_servers': ['server_schedule'], 'server_schedule': [[0.5, 0], [0.55, 1], [3.0, 0]]} - Q = ciw.Simulation(ciw.Network_From_Dictionary(params), exact=14) + Q = ciw.Simulation(ciw.create_network(params), exact=14) Q.simulate_until_max_time(10) recs = Q.get_all_records(headers=False) mod_service_starts = [obs%3 for obs in [r[5] for r in recs]] diff --git a/ciw/tests/test_state_tracker.py b/ciw/tests/test_state_tracker.py index 511d58c5..10bb3fed 100644 --- a/ciw/tests/test_state_tracker.py +++ b/ciw/tests/test_state_tracker.py @@ -4,14 +4,14 @@ class TestStateTracker(unittest.TestCase): def test_base_init_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.simulation, Q) self.assertEqual(B.state, None) def test_base_change_state_accept_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.state, None) @@ -19,7 +19,7 @@ def test_base_change_state_accept_method(self): self.assertEqual(B.state, None) def test_base_change_state_block_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.state, None) @@ -27,7 +27,7 @@ def test_base_change_state_block_method(self): self.assertEqual(B.state, None) def test_base_change_state_release_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.state, None) @@ -35,13 +35,13 @@ def test_base_change_state_release_method(self): self.assertEqual(B.state, None) def test_base_hash_state_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.StateTracker(Q) self.assertEqual(B.hash_state(), None) def test_base_release_method_within_simulation(self): - Net = ciw.Network_From_File( + Net = ciw.create_network( 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(Net) N = Q.transitive_nodes[2] @@ -60,7 +60,7 @@ def test_base_release_method_within_simulation(self): self.assertEqual(Q.statetracker.state, None) def test_base_block_method_within_simulation(self): - Net = ciw.Network_From_File( + Net = ciw.create_network( 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(Net) N = Q.transitive_nodes[2] @@ -69,7 +69,7 @@ def test_base_block_method_within_simulation(self): self.assertEqual(Q.statetracker.state, None) def test_base_accept_method_within_simulation(self): - Net = ciw.Network_From_File( + Net = ciw.create_network( 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(Net) N = Q.transitive_nodes[2] @@ -83,14 +83,14 @@ def test_base_accept_method_within_simulation(self): class TestNaiveTracker(unittest.TestCase): def test_naive_init_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) self.assertEqual(B.simulation, Q) self.assertEqual(B.state, [[0, 0], [0, 0], [0, 0], [0, 0]]) def test_naive_change_state_accept_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) self.assertEqual(B.state, [[0, 0], [0, 0], [0, 0], [0, 0]]) @@ -98,7 +98,7 @@ def test_naive_change_state_accept_method(self): self.assertEqual(B.state, [[1, 0], [0, 0], [0, 0], [0, 0]]) def test_naive_change_state_block_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) B.state = [[1, 0], [0, 0], [0, 0], [0, 0]] @@ -106,7 +106,7 @@ def test_naive_change_state_block_method(self): self.assertEqual(B.state, [[0, 1], [0, 0], [0, 0], [0, 0]]) def test_naive_change_state_release_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) B.state = [[2, 1], [3, 0], [1, 0], [4, 4]] @@ -116,14 +116,14 @@ def test_naive_change_state_release_method(self): self.assertEqual(B.state, [[1, 0], [3, 0], [1, 0], [4, 4]]) def test_naive_hash_state_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.NaiveTracker(Q) B.state = [[3, 4], [1, 2], [0, 1], [0, 0]] self.assertEqual(B.hash_state(), ((3, 4), (1, 2), (0, 1), (0, 0))) def test_naive_release_method_within_simulation(self): - params = ciw.Network_From_File( + params = ciw.create_network( 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(params, tracker='Naive') N = Q.transitive_nodes[2] @@ -143,7 +143,7 @@ def test_naive_release_method_within_simulation(self): self.assertEqual(Q.statetracker.state, [[6, 1], [3, 0], [3, 0], [0, 0]]) def test_naive_block_method_within_simulation(self): - params = ciw.Network_From_File( + params = ciw.create_network( 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(params, tracker='Naive') N = Q.transitive_nodes[2] @@ -153,7 +153,7 @@ def test_naive_block_method_within_simulation(self): self.assertEqual(Q.statetracker.state, [[4, 1], [3, 0], [4, 2], [0, 0]]) def test_naive_accept_method_within_simulation(self): - params = ciw.Network_From_File( + params = ciw.create_network( 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(params, tracker='Naive') N = Q.transitive_nodes[2] @@ -167,7 +167,7 @@ def test_naive_accept_method_within_simulation(self): class TestMatrixTracker(unittest.TestCase): def test_matrix_init_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) self.assertEqual(B.simulation, Q) @@ -178,7 +178,7 @@ def test_matrix_init_method(self): [0, 0, 0, 0]]) def test_matrix_change_state_accept_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) self.assertEqual(B.state, [[[[], [], [], []], @@ -194,7 +194,7 @@ def test_matrix_change_state_accept_method(self): [1, 0, 0, 0]]) def test_matrix_change_state_block_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) B.state = [[[[], [], [], []], @@ -222,7 +222,7 @@ def test_matrix_change_state_block_method(self): [2, 3, 1, 0]]) def test_matrix_change_state_release_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) B.state = [[[[], [], [1, 3], []], @@ -244,7 +244,7 @@ def test_matrix_change_state_release_method(self): [1, 3, 0, 0]]) def test_matrix_hash_state_method(self): - Q = ciw.Simulation(ciw.Network_From_File( + Q = ciw.Simulation(ciw.create_network( 'ciw/tests/testing_parameters/params.yml')) B = ciw.MatrixTracker(Q) B.state = [[[[], [], [1, 3], []], @@ -259,7 +259,7 @@ def test_matrix_hash_state_method(self): (2, 3, 0, 0))) def test_matrix_release_method_within_simulation(self): - params = ciw.Network_From_File( + params = ciw.create_network( 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(params, tracker='Matrix') N = Q.transitive_nodes[2] @@ -300,7 +300,7 @@ def test_matrix_release_method_within_simulation(self): [7, 3, 3, 0]]) def test_matrix_block_method_within_simulation(self): - params = ciw.Network_From_File( + params = ciw.create_network( 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(params, tracker='Matrix') N = Q.transitive_nodes[2] @@ -323,7 +323,7 @@ def test_matrix_block_method_within_simulation(self): [5, 3, 6, 0]]) def test_matrix_accept_method_within_simulation(self): - params = ciw.Network_From_File( + params = ciw.create_network( 'ciw/tests/testing_parameters/params.yml') Q = ciw.Simulation(params, tracker='Matrix') N = Q.transitive_nodes[2] From 583ee7c0074bdfc11050b8c149547edd747a03e6 Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Thu, 21 Apr 2016 11:32:39 +0100 Subject: [PATCH 18/20] add test for create_network producing None --- ciw/tests/test_network.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ciw/tests/test_network.py b/ciw/tests/test_network.py index 58a504de..9d0c1a84 100644 --- a/ciw/tests/test_network.py +++ b/ciw/tests/test_network.py @@ -248,3 +248,10 @@ def test_raising_errors(self): params_list[22]['Class_change_matrices'] = {'Node 1':[[1.5]]} self.assertRaises(ValueError, ciw.create_network, params_list[22]) + def test_create_network_returns_none(self): + params1 = ['A', 'list', 'of', 'things.'] + params2 = "notayamlfile.csv" + params3 = 10 + self.assertEqual(ciw.create_network(params1), None) + self.assertEqual(ciw.create_network(params2), None) + self.assertEqual(ciw.create_network(params3), None) \ No newline at end of file From faa853d7b049c1b8137486a9669ff4d8eb660835 Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Thu, 21 Apr 2016 12:03:07 +0100 Subject: [PATCH 19/20] update docs with refactor changes --- docs/Basics/getting_started.rst | 8 ++-- docs/Basics/going_deeper.rst | 17 +++---- docs/Basics/parameters.rst | 36 +++------------ docs/Examples/mm1.rst | 6 +-- docs/Features/custom_dists.rst | 33 +++----------- docs/Features/deadlock.rst | 16 +++---- docs/Features/dynamic_classes.rst | 6 +-- docs/Features/exact.rst | 6 +-- docs/Features/server_schedules.rst | 31 +++++-------- docs/kwargs.rst | 71 ------------------------------ 10 files changed, 50 insertions(+), 180 deletions(-) diff --git a/docs/Basics/getting_started.rst b/docs/Basics/getting_started.rst index 66438f8a..a67b1171 100644 --- a/docs/Basics/getting_started.rst +++ b/docs/Basics/getting_started.rst @@ -32,7 +32,6 @@ We wish to simulate this system for 1000 time units. This system is defined by t ... 'Arrival_distributions': {'Class 0': [['Exponential', 6.0], ['Exponential', 2.5]]}, ... 'Number_of_nodes': 2, ... 'Detect_deadlock': False, - ... 'Simulation_time': 1000, ... 'Number_of_servers': [1, 1], ... 'Queue_capacities': ['Inf', 4], ... 'Number_of_classes': 1, @@ -41,11 +40,12 @@ We wish to simulate this system for 1000 time units. This system is defined by t ... } Please see :ref:`sim-parameters` for a fuller explaination of this. -Ciw can then use this parameters dictionary to run the simulation:: +Ciw can then create a Network obeject from this parameters dictionary, which is then used to run the simulation:: >>> import ciw - >>> Q = ciw.Simulation(params) - >>> Q.simulate_until_max_time() + >>> N = ciw.create_network(params) + >>> Q = ciw.Simulation(N) + >>> Q.simulate_until_max_time(1000) Once this simulation has been run, :ref:`output-file` can be written to file through:: diff --git a/docs/Basics/going_deeper.rst b/docs/Basics/going_deeper.rst index 3db14cb2..619ae347 100644 --- a/docs/Basics/going_deeper.rst +++ b/docs/Basics/going_deeper.rst @@ -11,22 +11,15 @@ Now importing Ciw and the parameters file as a dictionary is simple:: >>> params["Number_of_servers"] # doctest:+SKIP [2, 1, 1] # doctest:+SKIP -Set up a Simulation object, from which all parameters can also be accessed:: - - >>> Q = ciw.Simulation(params) # doctest:+SKIP - >>> Q.number_of_nodes # doctest:+SKIP - 3 # doctest:+SKIP - >>> Q.queue_capacities # doctest:+SKIP - ['Inf', 'Inf', 10] # doctest:+SKIP - >>> Q.lmbda # The arrival distributions of the system # doctest:+SKIP - [[['Exponential', 1.0], ['Exponential', 1.8], ['Exponential', 7.25]], [['Exponential', 6.0], ['Exponential', 4.5], ['Exponential', 2.0]]] # doctest:+SKIP - >>> Q.lmbda[0] # Arrival distributions of the 0th class # doctest:+SKIP - [['Exponential', 1.0], ['Exponential', 1.8], ['Exponential', 7.2]] # doctest:+SKIP +Set up a Network and Simulation objects, from which all parameters can also be accessed:: + + >>> N = ciw.create_network(params) # doctest:+SKIP + >>> Q = ciw.Simulation(N) # doctest:+SKIP A full list of Ciw's objects and attributes can be found here: :ref:`objects-attributes` Now to run a simulation simply run the following method:: - >>> Q.simulate_until_max_time() # doctest:+SKIP + >>> Q.simulate_until_max_time(1000) # doctest:+SKIP Individuals' data records can be accessed directly using the following methods:: diff --git a/docs/Basics/parameters.rst b/docs/Basics/parameters.rst index 2c28aaa7..161b7dfa 100644 --- a/docs/Basics/parameters.rst +++ b/docs/Basics/parameters.rst @@ -8,7 +8,6 @@ In order to fully define a queueing network simulation, the following need to be - Number of nodes (service stations) - Number of customer classes -- Simulation run time Every node must have the following defined globally (independent of customer class): @@ -25,7 +24,7 @@ And then each customer class requires: - Transition matrix -A full list of the parameters that a Ciw Simulation object can take can be seen here: :ref:`parameters-list`. +A full list of the parameters that a parameters dictionary needs can be seen here: :ref:`parameters-list`. Notice that: - :code:`Queue_capacities` can be set to :code:`"Inf"`. @@ -43,34 +42,12 @@ In this transition matrix the `(i,j)` th element corresponds to the probability There are numerous other features, please see :ref:`features` for more information. -There are three ways to imput parameters into the Simulation object: +There are two ways to imput parameters into the Simulation object: -* :ref:`using_kwargs` * :ref:`params_dict` * :ref:`params_file` -.. _using_kwargs: - ------------- -Using Kwargs ------------- - -The Simulation object can directly take in kwargs. An example is shown:: - - >>> import ciw - >>> Q = ciw.Simulation( - ... Arrival_distributions = {'Class 0': [['Exponential', 6.0], ['Exponential', 2.5]]}, - ... Number_of_nodes = 2, - ... Simulation_time = 1000, - ... Number_of_servers = [1, 1], - ... Queue_capacities = ['Inf', 4], - ... Number_of_classes = 1, - ... Service_distributions = {'Class 0': [['Exponential', 8.5], ['Exponential', 5.5]]}, - ... Transition_matrices = {'Class 0': [[0.0, 0.2], [0.1, 0.0]]} - ... ) - - .. _params_dict: ----------------------- @@ -83,14 +60,14 @@ The Simulation object can take a dictionary containing all the kwars as keys. An >>> params = { ... 'Arrival_distributions': {'Class 0': [['Exponential', 6.0], ['Exponential', 2.5]]}, ... 'Number_of_nodes': 2, - ... 'Simulation_time': 1000, ... 'Number_of_servers': [1, 1], ... 'Queue_capacities': ['Inf', 4], ... 'Number_of_classes': 1, ... 'Service_distributions': {'Class 0': [['Exponential', 8.5], ['Exponential', 5.5]]}, ... 'Transition_matrices': {'Class 0': [[0.0, 0.2], [0.1, 0.0]]} ... } - >>> Q = ciw.Simulation(params) + >>> N = ciw.create_network(params) + >>> Q = ciw.Simulation(N) .. _params_file: @@ -123,7 +100,6 @@ Ciw features a :code:`load_parameters` function that imports a parameters file a - 8.5 - - Exponential - 5.5 - Simulation_time: 1000 Transition_matrices: Class 0: - - 0.0 @@ -134,7 +110,7 @@ Ciw features a :code:`load_parameters` function that imports a parameters file a And then to load them in:: >>> import ciw - >>> params = ciw.load_parameters('parameters.yml') # doctest:+SKIP - >>> Q = ciw.Simulation(params) # doctest:+SKIP + >>> N = ciw.create_network('parameters.yml') # doctest:+SKIP + >>> Q = ciw.Simulation(N) # doctest:+SKIP The variable names are identical to the keys of the parameters dictionary. \ No newline at end of file diff --git a/docs/Examples/mm1.rst b/docs/Examples/mm1.rst index 65783f32..8f2dab0e 100644 --- a/docs/Examples/mm1.rst +++ b/docs/Examples/mm1.rst @@ -13,7 +13,6 @@ We set up the parameters in Ciw:: >>> params_dict = {'Arrival_distributions': {'Class 0': [['Exponential', 3.0]]}, ... 'Service_distributions': {'Class 0': [['Exponential', 5.0]]}, - ... 'Simulation_time': 250, ... 'Transition_matrices': {'Class 0': [[0.0]]}, ... 'Number_of_servers': [1] ... } @@ -24,8 +23,9 @@ It then returns the average wait in the system:: >>> import ciw >>> from random import seed >>> def iteration(warmup): - ... Q = ciw.Simulation(params_dict) - ... Q.simulate_until_max_time() + ... N = ciw.create_network(params_dict) + ... Q = ciw.Simulation(N) + ... Q.simulate_until_max_time(250) ... records = Q.get_all_records(headers=False) ... waits = [row[4] for row in records if row[3] > warmup] ... return sum(waits)/len(waits) diff --git a/docs/Features/custom_dists.rst b/docs/Features/custom_dists.rst index 4eab26d4..6bb9669b 100644 --- a/docs/Features/custom_dists.rst +++ b/docs/Features/custom_dists.rst @@ -16,17 +16,17 @@ An example distribution may look like this: In order to define this probability density function, it must be given a name. Let's call it :code:`my_special_distribution_01`. -In order to implement this in the parameters dictionary, simply state that that class and node's service distribution is :code:`Custom`, and the name the distribution as a parameter:: +In order to implement this in the parameters dictionary, simply state that that class and node's service distribution is :code:`Custom`, and the distribution as a parameter:: - 'Service_distributions':{'Class 0':[['Custom', 'my_special_distribution_01'], ['Exponential', 0.1]], 'Class 1':[['Exponential', 0.3], ['Exponential', 0.1]]} + 'Service_distributions':{'Class 0':[['Custom', [[0.1, 9.5], [0.1, 10.2], [0.3, 10.6], [0.2, 10.9], [0.2, 11.7], [0.2, 12.1]]], ['Exponential', 0.1]], 'Class 1':[['Exponential', 0.3], ['Exponential', 0.1]]} -In the :code:`parameters.yml` file, under :code:`Serivce_rates`, for the given class and node enter :code:`Custom` and the name of the distribution below it. +In the :code:`parameters.yml` file, under :code:`Serivce_rates`, for the given class and node enter :code:`Custom` and the distribution below it. An example is shown:: Service_distributions: Class 0: - - Custom - - my_special_distribution_01 + - [[0.1, 9.5], [0.1, 10.2], [0.3, 10.6], [0.2, 10.9], [0.2, 11.7], [0.2, 12.1]] - - Exponential - 0.1 Class 1: @@ -35,33 +35,14 @@ An example is shown:: - - Exponential - 0.1 -This tells Ciw that at Node 1 all Class 0 customers will have their service time drawn from the custom distribution :code:`my_special_distribution_01`. -This distribution hasn't been defined yet. +The distribution, is a list of lists:: -To define the distribution, add the following to your parameters dictionary:: + [[0.1, 9.5], [0.1, 10.2], [0.3, 10.6], [0.2, 10.9], [0.2, 11.7], [0.2, 12.1]] - 'my_special_distribution':[[0.1, 9.5], [0.1, 10.2], [0.3, 10.6], [0.2, 10.9], [0.2, 11.7], [0.2, 12.1]] - -To define the distribution in the :code:`parameters.yml` file, add the following lines to the end:: - - my_special_distribution_01: - - - 0.1 - - 9.5 - - - 0.1 - - 10.2 - - - 0.3 - - 10.6 - - - 0.2 - - 10.9 - - - 0.2 - - 11.7 - - - 0.1 - - 12.1 Here we are saying that the value 9.5 will be sampled with probability 0.1, the value 10.2 will be samples with probability 0.1, etc. This fully defines the custom discrete PDF. Note: -- For each distribution, probabilities must sum to 1. -- You may add as many custom probability distributions as you like. \ No newline at end of file +- For each distribution, probabilities must sum to 1. \ No newline at end of file diff --git a/docs/Features/deadlock.rst b/docs/Features/deadlock.rst index 2e6fd6d4..aa34ff31 100644 --- a/docs/Features/deadlock.rst +++ b/docs/Features/deadlock.rst @@ -6,16 +6,16 @@ Deadlock Detection Capability Ciw's has built in deadlock detection capability. With Ciw, a queueing network can be simulated until it reaches deadlock. Ciw then records the time until deadlock from each state. -In order to take advantage of this feature, set deadlock detection option to True in the parameters file:: +In order to take advantage of this feature, set deadlock_detection argument to one of the deadlock detectio methods when creating the Simulation object:: - Detect_deadlock: StateDigraph + >>> Q = ciw.Simulation(params, deadlock_detector='StateDigraph') # doctest:+SKIP Then use the :code:`simulate_until_deadlock` method. The attribute :code:`times_to_deadlock` contains the times to deadlock from each state:: - >>> import ciw - >>> Q = ciw.Simulation(deadlock_params) # doctest:+SKIP - >>> Q.simulate_until_deadlock() # doctest:+SKIP - >>> times = Q.times_to_deadlock # doctest:+SKIP + >>> import ciw + >>> Q = ciw.Simulation(params, deadlock_detector='StateDigraph') # doctest:+SKIP + >>> Q.simulate_until_deadlock() # doctest:+SKIP + >>> times = Q.times_to_deadlock # doctest:+SKIP where :code:`times` is a dictionary with states as keys and times to deadlock as values. Note that :code:`Simulation_time` is ingnored in this case. @@ -31,7 +31,6 @@ Parameters:: >>> params = {'Arrival_distributions': {'Class 0': [['Exponential', 6.0]]}, ... 'Number_of_nodes': 1, - ... 'Detect_deadlock': 'StateDigraph', ... 'Number_of_servers': [1], ... 'Queue_capacities': [3], ... 'Number_of_classes': 1, @@ -43,7 +42,8 @@ Running until deadlock:: >>> import ciw >>> from random import seed >>> seed(99) - >>> Q = ciw.Simulation(params) + >>> N = ciw.create_network(params) + >>> Q = ciw.Simulation(N, deadlock_detector='StateDigraph') >>> Q.simulate_until_deadlock() >>> self.times_to_deadlock # doctest:+SKIP {((1, 0),): 1.0845416939916719, ((3, 0),): 0.5436399978272065, ((0, 0),): 1.1707879982560288, ((4, 0),): 0.15650986183172932, ((3, 1),): 0.0, ((2, 0),): 1.0517097907100657} diff --git a/docs/Features/dynamic_classes.rst b/docs/Features/dynamic_classes.rst index a201276c..877cc3eb 100644 --- a/docs/Features/dynamic_classes.rst +++ b/docs/Features/dynamic_classes.rst @@ -33,12 +33,12 @@ In this example a customer of class 0 finishing service at node 1 will become cl This is input into the simulation model by including the following to the parameters dictionary:: - 'Class_change_matrices': {'Node 0': [[0.3, 0.4, 0.3], [0.1, 0.9, 0.0], [0.5, 0.1, 0.4]], 'Node 1': [[1.0, 0.0, 0.0], [0.4, 0.5, 0.1], [0.2, 0.2, 0.6]]} + 'Class_change_matrices': {'Node 1': [[0.3, 0.4, 0.3], [0.1, 0.9, 0.0], [0.5, 0.1, 0.4]], 'Node 2': [[1.0, 0.0, 0.0], [0.4, 0.5, 0.1], [0.2, 0.2, 0.6]]} This is equivalent to adding the following code to the parameters file:: Class_change_matrices: - Node 0: + Node 1: - - 0.3 - 0.4 - 0.3 @@ -48,7 +48,7 @@ This is equivalent to adding the following code to the parameters file:: - - 0.5 - 0.1 - 0.4 - Node 1: + Node 2: - - 1.0 - 0.0 - 0.0 diff --git a/docs/Features/exact.rst b/docs/Features/exact.rst index e53f5b7f..017ff2e9 100644 --- a/docs/Features/exact.rst +++ b/docs/Features/exact.rst @@ -6,8 +6,8 @@ Exactness Due to the `issues and limitations `_ that arise when dealing with floating point numbers, Ciw offers an exactness option. Beware however, that using this option may affect performance, and so should only be used if issues with floating point numbers are affecting your results. This may happen for example while using deterministic distributions and server schedules. -In order to implement arithmetical exactness, add this option to the parameters dictionary:: +In order to implement arithmetical exactness, add this argument when creating the simulation object:: - 'Exact': 26 + >>> Q = ciw.Simulation(N, exact=26) # doctest:+SKIP -The key :code:`Exact` is used to indicate the precision level. \ No newline at end of file +The argument :code:`exact` is used to indicate the precision level. \ No newline at end of file diff --git a/docs/Features/server_schedules.rst b/docs/Features/server_schedules.rst index f2630fc8..adfaf3fa 100644 --- a/docs/Features/server_schedules.rst +++ b/docs/Features/server_schedules.rst @@ -18,19 +18,14 @@ This schedule is cyclic, therefore after the last shift (220-250), schedule begi In order to define this work schedule, it must be given a name. Let's call it :code:`my_special_schedule_01`. -In the :code:`parameters.yml` file, under :code:`Number_of_servers`, for the given node enter the name of the schedule. The :code:`Cycle_length` must also be given. +In the :code:`parameters.yml` file, under :code:`Number_of_servers`, for the given node enter the name of the schedule. An example is shown:: - Cycle_length: 250 Number_of_servers: - 'my_special_schedule_01' - 3 -The equivalent way to add this to the parameters dictionary is by first adding the cycle length:: - - 'Cycle_length':250 - -And then under number of servers, add the schedule name:: +The equivalent way to add this to the parameters dictionary:: 'Number_of_servers':['my_special_schedule_01', 3] @@ -39,26 +34,22 @@ This schedule hasn't been defined yet. To define the work schedule, add the following lines to the end of the :code:`parameters.yml` file:: my_special_schedule_01: - - - 0 - - 2 - - 40 - - 3 + - 2 - - 100 - - 1 + - 3 - - 120 - - 2 + - 1 - - 180 - - 4 + - 2 - - 220 + - 4 + - - 250 - 0 And equivalently, adding the following to the parameters dictionary:: - 'my_special_schedule_01':[[0, 2], [40, 3], [100, 1], [120, 2], [180, 4], [220, 0]] - -Here we are saying that there will be 2 servers scheduled between times 0 and 40, 3 between 40 and 100, etc. The final shift denotes 0 servers between times 220 and :code:`Cycle_length`, and then the schedule cycles to the beginning. -This fully defines the cyclic work schedule. - -Note: + 'my_special_schedule_01':[[40, 2], [100, 3], [120, 1], [180, 2], [220, 4], [250, 0]] -- If more than one work schedule is defined, the same :code:`Cycle_length` must be used for the entire system. \ No newline at end of file +Here we are saying that there will be 2 servers scheduled between times 0 and 40, 3 between 40 and 100, etc. +This fully defines the cyclic work schedule. \ No newline at end of file diff --git a/docs/kwargs.rst b/docs/kwargs.rst index cd1742d0..1123a637 100644 --- a/docs/kwargs.rst +++ b/docs/kwargs.rst @@ -43,53 +43,6 @@ An example for a two node network with two classes of customer:: [0.4, 0.5, 0.1], [0.2, 0.2, 0.6]]} -Cycle_length -~~~~~~~~~~~~ - -*Optional, required if server schedules are used* - -The length of a cycle of a server schedule. For more details see :ref:`server-schedules`. - -An example is shown:: - - 'Cycle_length': 7 - - -Detect_deadlock -~~~~~~~~~~~~~~~ - -*Optional, required if using simulate_until_deadlock()* - -Indicates which deadlock detection mechanism is to be used, if any. For more details see :ref:`deadlock-detection`. - -An example of no deadlock detection is shown (although omitting this argument will yield the same results):: - - 'Detect_deadlock': False - - -Exact -~~~~~ - -*Optional* - -The exact option allows for exactness, and indicates the level of exactness required. It should only be used when absolutely necessary. For more details see :ref:`exact-simulations`. - -Example:: - - 'Exact': 26 - - -Name -~~~~ - -*Optional* - -A string to represent the simulation class. A default value of 'Simulation' is given. - -Example:: - - 'Name': 'My Awsome Simulation!' - Number_of_classes ~~~~~~~~~~~~~~~~~ @@ -158,30 +111,6 @@ An example where only one class of customer is required:: ['Exponential', 5.2]] -Simulation_time -~~~~~~~~~~~~~~~ - -*Optional, required if using simulate_until_max_time()* - -The amount of time units to run the simulation for. - -Example:: - - 'Simulation_time': 2500 - - -Tracker -~~~~~~~ - -*Optional* - -Indicates which state tracking mechanism is to be used. For more details see :ref:`state-tracker`. If omitted no state tracker is used, unless there is a deadlock detection mechanism in place, in which case the Naïve Tracker is used. - -Example:: - - 'Tracker': 'Naive' - - Transition_matrices ~~~~~~~~~~~~~~~~~~~ From 11fed47182bf9052f5afcf3b2f9657d0cb4e105e Mon Sep 17 00:00:00 2001 From: Geraint Palmer Date: Thu, 21 Apr 2016 13:24:35 +0100 Subject: [PATCH 20/20] add test for sim events interesting case --- .../a40d01c034da88b1/5b4b824207f1d385 | Bin 0 -> 32 bytes .../a40d01c034da88b1/b30594f98ec722df | Bin 0 -> 32 bytes .../a40d01c034da88b1/bc7b57ab3cacdfda | Bin 0 -> 32 bytes .../a40d01c034da88b1/c10bc405e87905b5 | Bin 0 -> 32 bytes ciw/import_params.py | 12 ++++---- ciw/tests/test_simulation.py | 26 ++++++++++-------- 6 files changed, 21 insertions(+), 17 deletions(-) create mode 100644 .hypothesis/examples/a40d01c034da88b1/5b4b824207f1d385 create mode 100644 .hypothesis/examples/a40d01c034da88b1/b30594f98ec722df create mode 100644 .hypothesis/examples/a40d01c034da88b1/bc7b57ab3cacdfda create mode 100644 .hypothesis/examples/a40d01c034da88b1/c10bc405e87905b5 diff --git a/.hypothesis/examples/a40d01c034da88b1/5b4b824207f1d385 b/.hypothesis/examples/a40d01c034da88b1/5b4b824207f1d385 new file mode 100644 index 0000000000000000000000000000000000000000..66afcbeca5f0ecbaa4747a736493bc1fb4bfa313 GIT binary patch literal 32 VcmcEDIdi`Q5HO$sVFi1rH~@1l2Gjrm literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/b30594f98ec722df b/.hypothesis/examples/a40d01c034da88b1/b30594f98ec722df new file mode 100644 index 0000000000000000000000000000000000000000..d4f52e523b6de46c831ac0a2b95b14e229e02b3c GIT binary patch literal 32 TcmcEj?*Il2C_q@j9x4t1U@!%+ literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/bc7b57ab3cacdfda b/.hypothesis/examples/a40d01c034da88b1/bc7b57ab3cacdfda new file mode 100644 index 0000000000000000000000000000000000000000..bcb2a4339edd890235696547090f3c53fa9b3385 GIT binary patch literal 32 ccmZ<|vvcURW0Yk;0m2Fn{Lh=Sb_JIL07GO2mH+?% literal 0 HcmV?d00001 diff --git a/.hypothesis/examples/a40d01c034da88b1/c10bc405e87905b5 b/.hypothesis/examples/a40d01c034da88b1/c10bc405e87905b5 new file mode 100644 index 0000000000000000000000000000000000000000..007608ca208887920d93bc71f2a4ce89f341246b GIT binary patch literal 32 UcmcED`QHHq7*K$)f<06m0C1=Vq5uE@ literal 0 HcmV?d00001 diff --git a/ciw/import_params.py b/ciw/import_params.py index 7b43fc7e..e239cb03 100644 --- a/ciw/import_params.py +++ b/ciw/import_params.py @@ -1,5 +1,6 @@ import os import yaml +import copy from network import * @@ -32,17 +33,17 @@ def create_network_from_yml(directory_name): """ Creates a Network object form a yaml file """ - params = load_parameters(directory_name) - fill_out_dictionary(params) + params_input = load_parameters(directory_name) + params = fill_out_dictionary(params_input) validify_dictionary(params) return create_network_from_dictionary(params) -def create_network_from_dictionary(params): +def create_network_from_dictionary(params_input): """ Creates a Network object from a parameters dictionary """ - fill_out_dictionary(params) + params = fill_out_dictionary(params_input) validify_dictionary(params) # Then make the Network object arrivals = [params['Arrival_distributions']['Class ' + str(cls)] @@ -78,11 +79,12 @@ def create_network_from_dictionary(params): return Network(nodes, classes) -def fill_out_dictionary(params): +def fill_out_dictionary(params_input): """ Fills out the parameters dictionary with the optional arguments """ + params = copy.deepcopy(params_input) if isinstance(params['Arrival_distributions'], list): arr_dists = params['Arrival_distributions'] params['Arrival_distributions'] = {'Class 0': arr_dists} diff --git a/ciw/tests/test_simulation.py b/ciw/tests/test_simulation.py index 75fc6fca..bc18bd29 100644 --- a/ciw/tests/test_simulation.py +++ b/ciw/tests/test_simulation.py @@ -205,11 +205,13 @@ def test_simultaneous_events_example(self): # Due to randomly choosing the order of events, the seed has # a big affect on this. - set_seed(73) params = {'Arrival_distributions': [['Deterministic', 10.0], 'NoArrivals'], 'Service_distributions': [['Deterministic', 5.0], ['Deterministic', 5.0]], 'Transition_matrices': [[1.0, 0.0], [0.0, 0.0]], 'Number_of_servers': [2, 1]} + + + set_seed(73) Q = ciw.Simulation(ciw.create_network(params)) Q.simulate_until_max_time(36) inds = Q.get_all_individuals() @@ -217,12 +219,7 @@ def test_simultaneous_events_example(self): self.assertEqual(len(inds), 2) self.assertTrue(all([x[6] == 5.0 for x in recs[1:]])) - set_seed(74) - params = {'Arrival_distributions': [['Deterministic', 10.0], 'NoArrivals'], - 'Service_distributions': [['Deterministic', 5.0], ['Deterministic', 5.0]], - 'Transition_matrices': [[1.0, 0.0], [0.0, 0.0]], - 'Number_of_servers': [2, 1]} Q = ciw.Simulation(ciw.create_network(params)) Q.simulate_until_max_time(36) inds = Q.get_all_individuals() @@ -230,13 +227,22 @@ def test_simultaneous_events_example(self): self.assertEqual(len(inds), 3) self.assertTrue(all([x[6] == 5.0 for x in recs[1:]])) + completed_inds = [] + for _ in xrange(1000): + Q = ciw.Simulation(ciw.create_network(params)) + Q.simulate_until_max_time(36) + inds = Q.get_all_individuals() + completed_inds.append(len(inds)) + self.assertAlmostEqual(completed_inds.count(2) / float(1000), 1 / 4.0, places=1) + def test_exactness(self): - set_seed(777) params = {'Arrival_distributions': [['Exponential', 20]], 'Service_distributions': [['Deterministic', 0.01]], 'Transition_matrices': [[0.0]], 'Number_of_servers': ['server_schedule'], 'server_schedule': [[0.5, 0], [0.55, 1], [3.0, 0]]} + + set_seed(777) Q = ciw.Simulation(ciw.create_network(params)) Q.simulate_until_max_time(10) recs = Q.get_all_records(headers=False) @@ -244,14 +250,10 @@ def test_exactness(self): self.assertNotEqual(set(mod_service_starts), set([0.50, 0.51, 0.52, 0.53, 0.54])) set_seed(777) - params = {'Arrival_distributions': [['Exponential', 20]], - 'Service_distributions': [['Deterministic', 0.01]], - 'Transition_matrices': [[0.0]], - 'Number_of_servers': ['server_schedule'], - 'server_schedule': [[0.5, 0], [0.55, 1], [3.0, 0]]} Q = ciw.Simulation(ciw.create_network(params), exact=14) Q.simulate_until_max_time(10) recs = Q.get_all_records(headers=False) mod_service_starts = [obs%3 for obs in [r[5] for r in recs]] expected_set = set([Decimal(k) for k in ['0.50', '0.51', '0.52', '0.53', '0.54']]) self.assertEqual(set(mod_service_starts), expected_set) +