Last active
December 22, 2016 00:02
-
-
Save blob42/a9878c518a3197fe668b9b1e6b1118e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| ## Research each questions and give it a weight between 0 and 100 | |
| ## Based on the expected effort | |
| ## The pointWeitht dict is in the form | |
| ## {question: (points, weight)} | |
| ## Points is the points given and weight is the effort | |
| from itertools import combinations | |
| pointWeights = {'auth-aliases': (2, 30), | |
| 'backup-solution': (2, 20), | |
| 'ca-root': (1, 40), | |
| 'config-root-certificate-deployment': (2, 70), | |
| 'config-security-policies': (3, 80), | |
| 'config-update-puppet': (1,40), | |
| 'high-availability': (2, 50), | |
| 'ipsec': (3, 70), | |
| 'mail-serv-certificate': (1, 40), | |
| 'mounted-sync-drbd': (1, 35), | |
| 'proto ssl/tls': (2, 65), | |
| 'send-receive': (1, 30)} | |
| allCombinations = [] | |
| for i in range(1, len(pointWeights) + 1): | |
| allCombinations.extend(combinations(pointWeights, i)) | |
| combinPoints = [(combin, sum([pointWeights[key][0] for key in combin])) for combin in allCombinations] | |
| combinHigherThan16 = [combin for combin in filter(lambda x: x[1] >= 16 ,combinPoints)] | |
| combinHigherThan16WithWeight = [(combin[0], sum(pointWeights[key][1] for key in combin[0])) for combin in combinHigherThan16] | |
| combinHigherThan16WithWeight = sorted(combinHigherThan16WithWeight, key=lambda x: x[1]) | |
| bestCombins = combinHigherThan16WithWeight[:int(len(combinHigherThan16WithWeight) * 0.2) - 1] | |
| print(bestCombins[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment