static void EvaluateWithoutSpecificSet(Maze maze, double[,] pathMatrix, List <Triplet> setToAvoid, out double score, out double lengthScore, out int finalNumberOfItems) { //Construct the dual of the set to avoid List <Triplet> setToEvaluate = new List <Triplet>(); for (int i = 0; i < maze.StatesCount; i++) { for (int j = 0; j < maze.StatesCount; j++) { Triplet?foundTriplet = null; foreach (Triplet item in setToAvoid) { if (item.x0 == i && item.g == j) { foundTriplet = item; break; } } //We add the item only if it is not present in the set to avoid if (foundTriplet == null) { Triplet t = new Triplet(); t.x0 = i; t.g = j; t.x1 = -1; // doesnt matter setToEvaluate.Add(t); } } } EvaluateSpecificSet(maze, pathMatrix, setToEvaluate, out score, out lengthScore, out finalNumberOfItems); }
static List <Triplet> GetTripletsFromSequence(Sequence s) { List <Triplet> results = new List <Triplet>(); for (int i = 0; i < s.Count; i++) { for (int j = 1; j <= i; j++) { Triplet t = new Triplet(); t.x0 = s[j - 1]; t.x1 = s[j]; t.g = s[i]; t.distance = i - j; results.Add(t); } } return(results); }
static List <Triplet> GenerateTestSet_1LengthPath(Maze maze) { List <Triplet> testSet = new List <Triplet>(); for (int i = 0; i < maze.StatesCount; i++) { for (int j = 0; j < maze.StatesCount; j++) { if (maze.AdjMatrix[i, j] != 0.0) { Triplet t = new Triplet(); t.x0 = i; t.x1 = j; t.g = j; testSet.Add(t); } } } return(testSet); }