Esempio n. 1
0
        public List <int> GetRanksPROMETHEE()
        {
            PROMETHEEDecisionProvider      provider = new PROMETHEEDecisionProvider();
            PROMETHEEDecisionConfiguration config   = new PROMETHEEDecisionConfiguration
            {
                CriteriaRanks       = _criterias.GetNormalizedWeight(),
                PreferenceFunctions = _criterias.GetPreferenceFunctions()
            };

            provider.Init(config);

            AlternativesBase alternatives = GetAlternativesBases(MethodsEnum.PROMETHEE);

            List <int> result = provider.Solve(alternatives).Ranks;

            return(result);
        }
Esempio n. 2
0
        public void TestPROMETHEEDecision()
        {
            PROMETHEEDecisionProvider      provider = new PROMETHEEDecisionProvider();
            PROMETHEEDecisionConfiguration config   = new PROMETHEEDecisionConfiguration
            {
                CriteriaRanks = new List <double> {
                    1.0 / 6, 1.0 / 6, 1.0 / 6, 1.0 / 6, 1.0 / 6, 1.0 / 6
                },
                PreferenceFunctions = new List <PreferenceFunction>
                {
                    new PreferenceFunction(
                        PreferenceFunctionEnum.QuasiCriterion,
                        new List <double> {
                        10
                    }
                        ),
                    new PreferenceFunction(
                        PreferenceFunctionEnum.VShapeCriterion,
                        new List <double> {
                        30
                    }
                        ),
                    new PreferenceFunction(
                        PreferenceFunctionEnum.LinearCriterion,
                        new List <double> {
                        50, 450
                    }
                        ),
                    new PreferenceFunction(
                        PreferenceFunctionEnum.LevelCriterion,
                        new List <double> {
                        10, 50
                    }
                        ),
                    new PreferenceFunction(
                        PreferenceFunctionEnum.UsualCriterion,
                        new List <double>()
                        ),
                    new PreferenceFunction(
                        PreferenceFunctionEnum.GaussianCriterion,
                        new List <double> {
                        5
                    }
                        )
                }
            };

            provider.Init(config);

            var Alternatives = new AlternativesBase
            {
                Criterias = new List <ICriteria>
                {
                    new CriteriaBase {
                        CriteriaDirection = CriteriaDirectionType.Minimization
                    },
                    new CriteriaBase {
                        CriteriaDirection = CriteriaDirectionType.Maximization
                    },
                    new CriteriaBase {
                        CriteriaDirection = CriteriaDirectionType.Minimization
                    },
                    new CriteriaBase {
                        CriteriaDirection = CriteriaDirectionType.Minimization
                    },
                    new CriteriaBase {
                        CriteriaDirection = CriteriaDirectionType.Minimization
                    },
                    new CriteriaBase {
                        CriteriaDirection = CriteriaDirectionType.Maximization
                    }
                },
                Alternatives = new List <AlternativeBase>
                {
                    new AlternativeBase
                    {
                        Values = new List <IAlternativeValue>
                        {
                            new AlternativeValueBase(80),
                            new AlternativeValueBase(90),
                            new AlternativeValueBase(600),
                            new AlternativeValueBase(54),
                            new AlternativeValueBase(8),
                            new AlternativeValueBase(5)
                        }
                    },
                    new AlternativeBase
                    {
                        Values = new List <IAlternativeValue>
                        {
                            new AlternativeValueBase(65),
                            new AlternativeValueBase(58),
                            new AlternativeValueBase(200),
                            new AlternativeValueBase(97),
                            new AlternativeValueBase(1),
                            new AlternativeValueBase(1)
                        }
                    },
                    new AlternativeBase
                    {
                        Values = new List <IAlternativeValue>
                        {
                            new AlternativeValueBase(83),
                            new AlternativeValueBase(60),
                            new AlternativeValueBase(400),
                            new AlternativeValueBase(72),
                            new AlternativeValueBase(4),
                            new AlternativeValueBase(7)
                        }
                    },
                    new AlternativeBase
                    {
                        Values = new List <IAlternativeValue>
                        {
                            new AlternativeValueBase(40),
                            new AlternativeValueBase(80),
                            new AlternativeValueBase(1000),
                            new AlternativeValueBase(75),
                            new AlternativeValueBase(7),
                            new AlternativeValueBase(10)
                        }
                    },
                    new AlternativeBase
                    {
                        Values = new List <IAlternativeValue>
                        {
                            new AlternativeValueBase(52),
                            new AlternativeValueBase(72),
                            new AlternativeValueBase(600),
                            new AlternativeValueBase(20),
                            new AlternativeValueBase(3),
                            new AlternativeValueBase(8)
                        }
                    },
                    new AlternativeBase
                    {
                        Values = new List <IAlternativeValue>
                        {
                            new AlternativeValueBase(94),
                            new AlternativeValueBase(96),
                            new AlternativeValueBase(700),
                            new AlternativeValueBase(36),
                            new AlternativeValueBase(5),
                            new AlternativeValueBase(6)
                        }
                    }
                }
            };
            var result = provider.Solve(Alternatives);

            Assert.IsTrue(result.Ranks.Count == 6);
            Assert.IsTrue(result.Ranks[0] == 6);
            Assert.IsTrue(result.Ranks[1] == 2);
            Assert.IsTrue(result.Ranks[2] == 5);
            Assert.IsTrue(result.Ranks[3] == 3);
            Assert.IsTrue(result.Ranks[4] == 1);
            Assert.IsTrue(result.Ranks[5] == 4);
        }