hi,
I have a problem with my code , it is giving this error ('Net.Kniaz.AHP.AHPModel' does not contain a definition for 'AddCriteria' and no extension method 'AddCriteria' accepting a first argument of type 'Net.Kniaz.AHP.AHPModel' could be found (are you missing a using directive or an assembly reference?)) and I don't know what is the problem, I reviewed several similar question, but still couldn't find a solution.
note: I'm a very beginner programmer :)
Here is my code
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DotNetMatrix; using GeneralMatrix; using NUnit.Framework; using Net.Kniaz.AHP; namespace Net.Kniaz.AHP { public class AHPModel { public AHPModel(int n, int m); private GeneralMatrix _criteria; private GeneralMatrix _choiceMatrix; private GeneralMatrix _orderedCriteria; private GeneralMatrix _calculatedChoices; private int _ncriteria; private int _mchoice; private int _superDim; } public class TestAHP { public void TestVacationSpotSelection() { double[][] criteria = new double[][] { new double[] {1,5,0.33333333,1}, new double[] {0,1,0.2,0.5}, new double[] {0,0,1,3}, new double[] {0,0,0,1} }; double[][] activitiesChoices = new double[][] { new double[] {1,4,3}, new double[] {0,1,2}, new double[] {0,0,1} }; double[][] nightlifeChoices = new double[][] { new double[] {1,0.5,0.3333333}, new double[] {0,1,0.5}, new double[] {0,0,1} }; double[][] siteseeingChoices = new double[][] { new double[] {1,0.142857,0.2}, new double[] {0,1,2}, new double[] {0,0,1} }; double[][] costChoices = new double[][] { new double[] {1,3,5}, new double[] {0,1,2}, new double[] {0,0,1} }; //4 criteria, 3 choices AHPModel model = new AHPModel(4,3); model.AddCriteria(criteria); model.AddCriterionRatedChoices(0,activitiesChoices); model.AddCriterionRatedChoices(1,nightlifeChoices); model.AddCriterionRatedChoices(2,siteseeingChoices); model.AddCriterionRatedChoices(3,costChoices); model.CalculateModel(); GeneralMatrix calcCriteria = model.CalculatedCriteria; GeneralMatrix results = model.ModelResult; GeneralMatrix choices = model.CalculatedChoices; //choices: SF 42%, Orlando31%, NY 27% Assert.AreEqual(31,System.Math.Round(choices.GetElement(0,0)*100,0)); Assert.AreEqual(42,System.Math.Round(choices.GetElement(1,0)*100,0)); Assert.AreEqual(27,System.Math.Round(choices.GetElement(2,0)*100,0)); } } }
the error is in the lines (5 to 13) lines from the end (model.)
thank you