Skip to content

Instantly share code, notes, and snippets.

@labuzm
Created May 17, 2018 13:43
Show Gist options
  • Save labuzm/e25374b86385d9fed0cd43b4ffdee84c to your computer and use it in GitHub Desktop.
Save labuzm/e25374b86385d9fed0cd43b4ffdee84c to your computer and use it in GitHub Desktop.
from supplychainpy.model_decision import analytical_hierarchy_process
lorry_cost = {'scania': 55000, 'iveco': 79000, 'volvo': 59000, 'navistar': 66000}
criteria = ('style', 'reliability', 'comfort')
criteria_scores = [ (1 / 1, 2 / 1, 7 / 1, 9 / 1), (1 / 2, 1 / 1, 5 / 1, 5 / 1), (1 / 7, 1 / 5, 1 / 1, 5 / 1),(1 / 9, 1 / 5, 1 / 5, 1 / 1)]
options = ('scania', 'iveco', 'navistar', 'volvo' )
option_scores = {
'style': [(1 / 1, 1 / 3, 5 / 1, 1 / 5), (3 / 1, 1 / 1, 2 / 1, 3 / 1), (1 / 3, 1 / 5, 1 / 1, 1 / 5), (5 / 1, 1 / 3, 5 / 1, 1 / 1)],
'reliability': [(1 / 1, 1 / 3, 3 / 1, 1 / 7), (3 / 1, 1 / 1, 5 / 1, 1 / 5), (1 / 3, 1 / 5, 1 / 1, 1 / 5), (7 / 1, 5 / 1, 5 / 1, 1 / 1)],
'comfort': [(1 / 1, 5 / 1, 5 / 1, 1 / 7), (1 / 5, 1 / 1, 2 / 1, 1 / 7), (1 / 3, 1 / 5, 1 / 1, 1 / 5), (7 / 1, 7 / 1, 5 / 1, 1 / 1)],
}
lorry_decision = analytical_hierarchy_process(
criteria=criteria,
criteria_scores=criteria_scores,
options=options,
option_scores=option_scores,
item_cost=lorry_cost
)
print(lorry_decision)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment