View Source Descisionex.AnalyticHierarchy (Descisionex v0.1.8)

https://en.wikipedia.org/wiki/Analytic_hierarchy_process

Link to this section Summary

Functions

Calculates alternatives weights for analytic hierarchy (criteria must be set, such as comparison matrix and weights before must be calculated!).

Calculates alternatives weights by criteria for analytic hierarchy (criteria must be set, such as comparison matrix!).

Calculates weights for normalized comparison matrix for analytic hierarchy (criteria must be set, such as comparison matrix!).

Normalizes comparison matrix for analytic hierarchy (criteria must be set, such as comparison matrix!).

Set alternatives for analytic hierarchy.

Set alternatives matrix for analytic hierarchy (criteria must be set!).

Set criteria for analytic hierarchy.

Link to this section Functions

Link to this function

calculate_alternatives_weights(data)

View Source

Calculates alternatives weights for analytic hierarchy (criteria must be set, such as comparison matrix and weights before must be calculated!).

examples

Examples

iex> %Descisionex.AnalyticHierarchy{comparison_matrix: [[1, 2], [3, 4]]} |> Descisionex.AnalyticHierarchy.set_criteria(["some", "criteria"]) |> Descisionex.AnalyticHierarchy.normalize_comparison_matrix() |> Descisionex.AnalyticHierarchy.set_alternatives(["some", "alternatives"]) |> Descisionex.AnalyticHierarchy.set_alternatives_matrix([[[1, 2, 3]], [[4, 5, 6]]]) |> Descisionex.AnalyticHierarchy.calculate_alternatives_weights_by_criteria() |> Descisionex.AnalyticHierarchy.calculate_alternatives_weights()
** (ArgumentError) Weights must be calculated before!
iex> %Descisionex.AnalyticHierarchy{comparison_matrix: [[1, 2], [3, 4]]} |> Descisionex.AnalyticHierarchy.set_criteria(["some", "criteria"]) |> Descisionex.AnalyticHierarchy.normalize_comparison_matrix() |> Descisionex.AnalyticHierarchy.calculate_criteria_weights() |> Descisionex.AnalyticHierarchy.set_alternatives(["some", "alternatives"]) |> Descisionex.AnalyticHierarchy.set_alternatives_matrix([[[1, 2, 3]], [[4, 5, 6]]]) |> Descisionex.AnalyticHierarchy.calculate_alternatives_weights_by_criteria() |> Descisionex.AnalyticHierarchy.calculate_alternatives_weights()
%Descisionex.AnalyticHierarchy{
  alternatives: ["some", "alternatives"],
  alternatives_matrix: %{"criteria" => [[4, 5, 6]], "some" => [[1, 2, 3]]},
  alternatives_num: 2,
  alternatives_weights: [3.0],
  alternatives_weights_by_criteria: [[3.0, 3.0]],
  comparison_matrix: [[1, 2], [3, 4]],
  criteria: ["some", "criteria"],
  criteria_num: 2,
  criteria_weights: [[0.291], [0.709]],
  normalized_comparison_matrix: [[0.25, 0.333], [0.75, 0.667]]
}
Link to this function

calculate_alternatives_weights_by_criteria(data)

View Source

Calculates alternatives weights by criteria for analytic hierarchy (criteria must be set, such as comparison matrix!).

examples

Examples

iex> %Descisionex.AnalyticHierarchy{comparison_matrix: [[1, 2], [3, 4]]} |> Descisionex.AnalyticHierarchy.set_criteria(["some", "criteria"]) |> Descisionex.AnalyticHierarchy.calculate_alternatives_weights_by_criteria()
** (ArgumentError) Alternatives matrix must be set!
iex> %Descisionex.AnalyticHierarchy{} |> Descisionex.AnalyticHierarchy.set_criteria(["some", "criteria"]) |> Descisionex.AnalyticHierarchy.set_alternatives(["some", "alternatives"]) |> Descisionex.AnalyticHierarchy.set_alternatives_matrix([[[1, 2, 3]], [[4, 5, 6]]]) |> Descisionex.AnalyticHierarchy.calculate_alternatives_weights_by_criteria()
%Descisionex.AnalyticHierarchy{
  alternatives: ["some", "alternatives"],
  alternatives_matrix: %{"criteria" => [[4, 5, 6]], "some" => [[1, 2, 3]]},
  alternatives_num: 2,
  alternatives_weights: [],
  alternatives_weights_by_criteria: [[3.0, 3.0]],
  comparison_matrix: [],
  criteria: ["some", "criteria"],
  criteria_num: 2,
  criteria_weights: [],
  normalized_comparison_matrix: []
}
Link to this function

calculate_criteria_weights(data)

View Source

Calculates weights for normalized comparison matrix for analytic hierarchy (criteria must be set, such as comparison matrix!).

examples

Examples

iex> %Descisionex.AnalyticHierarchy{comparison_matrix: [[1, 2], [3, 4]]} |> Descisionex.AnalyticHierarchy.set_criteria(["some", "criteria"]) |> Descisionex.AnalyticHierarchy.calculate_criteria_weights()
** (ArgumentError) Comparison matrix must be normalized!
iex> %Descisionex.AnalyticHierarchy{comparison_matrix: [[1, 2], [3, 4]]} |> Descisionex.AnalyticHierarchy.set_criteria(["some", "criteria"]) |> Descisionex.AnalyticHierarchy.normalize_comparison_matrix() |> Descisionex.AnalyticHierarchy.calculate_criteria_weights()
%Descisionex.AnalyticHierarchy{
  alternatives: [],
  alternatives_matrix: %{},
  alternatives_num: 0,
  alternatives_weights: [],
  alternatives_weights_by_criteria: [],
  comparison_matrix: [[1, 2], [3, 4]],
  criteria: ["some", "criteria"],
  criteria_num: 2,
  criteria_weights: [[0.291], [0.709]],
  normalized_comparison_matrix: [[0.25, 0.333], [0.75, 0.667]]
}
Link to this function

normalize_comparison_matrix(data)

View Source

Normalizes comparison matrix for analytic hierarchy (criteria must be set, such as comparison matrix!).

examples

Examples

iex> %Descisionex.AnalyticHierarchy{} |> Descisionex.AnalyticHierarchy.set_criteria(["some", "criteria"]) |> Descisionex.AnalyticHierarchy.normalize_comparison_matrix()
** (ArgumentError) Comparison matrix must be set!
iex> %Descisionex.AnalyticHierarchy{comparison_matrix: [[1, 2], [3, 4]]} |> Descisionex.AnalyticHierarchy.set_criteria(["some", "criteria"]) |> Descisionex.AnalyticHierarchy.normalize_comparison_matrix()
%Descisionex.AnalyticHierarchy{
  alternatives: [],
  alternatives_matrix: %{},
  alternatives_num: 0,
  alternatives_weights: [],
  alternatives_weights_by_criteria: [],
  comparison_matrix: [[1, 2], [3, 4]],
  criteria: ["some", "criteria"],
  criteria_num: 2,
  criteria_weights: [],
  normalized_comparison_matrix: [[0.25, 0.333], [0.75, 0.667]]
}
Link to this function

set_alternatives(data, alternatives)

View Source

Set alternatives for analytic hierarchy.

examples

Examples

iex> %Descisionex.AnalyticHierarchy{} |> Descisionex.AnalyticHierarchy.set_alternatives([])
** (ArgumentError) Alternatives must be not empty!
iex> %Descisionex.AnalyticHierarchy{} |> Descisionex.AnalyticHierarchy.set_alternatives(["some", "alternatives"])
%Descisionex.AnalyticHierarchy{
  alternatives: ["some", "alternatives"],
  alternatives_matrix: %{},
  alternatives_num: 2,
  alternatives_weights: [],
  alternatives_weights_by_criteria: [],
  comparison_matrix: [],
  criteria: [],
  criteria_num: 0,
  criteria_weights: [],
  normalized_comparison_matrix: []
}
Link to this function

set_alternatives_matrix(data, matrix)

View Source

Set alternatives matrix for analytic hierarchy (criteria must be set!).

examples

Examples

iex> %Descisionex.AnalyticHierarchy{} |>  Descisionex.AnalyticHierarchy.set_alternatives_matrix([[1, 2], [3, 4]])
** (ArgumentError) Criteria must be set!
iex> %Descisionex.AnalyticHierarchy{} |> Descisionex.AnalyticHierarchy.set_criteria(["some", "criteria"]) |> Descisionex.AnalyticHierarchy.set_alternatives_matrix([[1, 2], [3, 4]])
%Descisionex.AnalyticHierarchy{
  alternatives: [],
  alternatives_matrix: %{"criteria" => [3, 4], "some" => [1, 2]},
  alternatives_num: 0,
  alternatives_weights: [],
  alternatives_weights_by_criteria: [],
  comparison_matrix: [],
  criteria: ["some", "criteria"],
  criteria_num: 2,
  criteria_weights: [],
  normalized_comparison_matrix: []
}
Link to this function

set_criteria(data, criteria)

View Source

Set criteria for analytic hierarchy.

examples

Examples

iex> %Descisionex.AnalyticHierarchy{} |> Descisionex.AnalyticHierarchy.set_criteria([])
** (ArgumentError) Criteria must be not empty!
iex> %Descisionex.AnalyticHierarchy{} |> Descisionex.AnalyticHierarchy.set_criteria(["some", "criteria"])
%Descisionex.AnalyticHierarchy{
  alternatives: [],
  alternatives_matrix: %{},
  alternatives_num: 0,
  alternatives_weights: [],
  alternatives_weights_by_criteria: [],
  comparison_matrix: [],
  criteria: ["some", "criteria"],
  criteria_num: 2,
  criteria_weights: [],
  normalized_comparison_matrix: []
}
Link to this function

set_tagged_alternatives_matrix(data, matrix)

View Source