Class: AHProcess::AnalyticHierarchyProcess
- Inherits:
-
Object
- Object
- AHProcess::AnalyticHierarchyProcess
- Defined in:
- lib/ahprocess/analytic_hierarchy_process.rb
Instance Attribute Summary collapse
-
#criteria_matrix ⇒ Object
readonly
Returns the value of attribute criteria_matrix.
-
#decision_matricies ⇒ Object
readonly
Returns the value of attribute decision_matricies.
-
#no_decisions ⇒ Object
readonly
Returns the value of attribute no_decisions.
Instance Method Summary collapse
- #consistency_ratios(random_consistency_index) ⇒ Object
- #decide ⇒ Object
-
#initialize(decision_matricies, criteria_matrix = [], no_decisions = 1) ⇒ AnalyticHierarchyProcess
constructor
A new instance of AnalyticHierarchyProcess.
Constructor Details
#initialize(decision_matricies, criteria_matrix = [], no_decisions = 1) ⇒ AnalyticHierarchyProcess
Returns a new instance of AnalyticHierarchyProcess.
7 8 9 10 11 |
# File 'lib/ahprocess/analytic_hierarchy_process.rb', line 7 def initialize(decision_matricies, criteria_matrix = [], no_decisions = 1) @no_decisions = no_decisions @criteria_matrix = AHPMatrix.new(criteria_matrix) @decision_matricies = decision_matricies.map { |matrix| AHPMatrix.new(matrix) } end |
Instance Attribute Details
#criteria_matrix ⇒ Object (readonly)
Returns the value of attribute criteria_matrix.
5 6 7 |
# File 'lib/ahprocess/analytic_hierarchy_process.rb', line 5 def criteria_matrix @criteria_matrix end |
#decision_matricies ⇒ Object (readonly)
Returns the value of attribute decision_matricies.
5 6 7 |
# File 'lib/ahprocess/analytic_hierarchy_process.rb', line 5 def decision_matricies @decision_matricies end |
#no_decisions ⇒ Object (readonly)
Returns the value of attribute no_decisions.
5 6 7 |
# File 'lib/ahprocess/analytic_hierarchy_process.rb', line 5 def no_decisions @no_decisions end |
Instance Method Details
#consistency_ratios(random_consistency_index) ⇒ Object
24 25 26 27 |
# File 'lib/ahprocess/analytic_hierarchy_process.rb', line 24 def consistency_ratios(random_consistency_index) return [decision_matricies.map { |pv| pv.consistency_ratio(random_consistency_index) }] if criteria_matrix.empty? [decision_matricies.map { |pv| pv.consistency_ratio(random_consistency_index) }, criteria_matrix.consistency_ratio(random_consistency_index)] end |
#decide ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ahprocess/analytic_hierarchy_process.rb', line 13 def decide return decision_matricies.map(&:preference_vector).first.to_a if criteria_matrix.empty? decision_preference_vectors = decision_matricies.map(&:preference_vector) criteria_preference_vector = criteria_matrix.preference_vector (0...no_decisions).map do |decision_index| criteria_preference_vector.inner_product(decision_preference_vectors.map { |pv| pv[decision_index] }) end end |