mcdm/lib.rs
1//! The `mcdm` crate offers a set of utilities for implementing Multiple-Criteria Decision Making
2//! (MCDM) techniques in Rust, enabling users to analyze and rank alternatives based on multiple
3//! conflicting criteria.
4//!
5//! # Example
6//!
7//! ```rust
8//! use mcdm::{McdmError, Rank, Normalize, Weight, CriteriaTypes};
9//! use nalgebra::dmatrix;
10//!
11//! fn main() -> Result<(), McdmError> {
12//! // Define the decision matrix (alternatives x criteria)
13//! let alternatives = dmatrix![4.0, 7.0, 8.0; 2.0, 9.0, 6.0; 3.0, 6.0, 9.0];
14//! let criteria_types = CriteriaTypes::from_slice(&[-1, 1, 1])?;
15//!
16//! // Apply normalization using Min-Max
17//! let normalized_matrix = alternatives.normalize_min_max(&criteria_types)?;
18//!
19//! // Alternatively, use equal weights
20//! let equal_weights = normalized_matrix.weight_equal()?;
21//!
22//! // Apply the TOPSIS method for ranking
23//! let ranking = normalized_matrix.rank_topsis(&equal_weights)?;
24//!
25//! // Output the ranking
26//! println!("Ranking: {:.3}", ranking);
27//! // Ranking:
28//! // ┌ ┐
29//! // │ 0.626 │
30//! // │ 0.414 │
31//! // │ 0.500 │
32//! // └ ┘
33//!
34//! Ok(())
35//! }
36//! ```
37#![no_std]
38
39#[cfg(any(test, feature = "std"))]
40extern crate std;
41
42pub mod correlation;
43pub mod criteria;
44pub mod dmatrix_ext;
45pub mod errors;
46pub mod normalization;
47pub mod ranking;
48pub mod validation;
49pub mod weighting;
50
51pub use crate::correlation::*;
52pub use crate::criteria::*;
53pub use crate::dmatrix_ext::*;
54pub use crate::errors::*;
55pub use crate::normalization::*;
56pub use crate::ranking::*;
57pub use crate::validation::*;
58pub use crate::weighting::*;