public IGraphColoringSolution Optimize() { GraphColoringSolution bestSolution = null; var solutionInfeasible = false; var maxColorsAllowed = _nodeAndArcRepository.GetAllNodes().Count(); while (!solutionInfeasible) { var domainStore = new DomainStore(_nodeAndArcRepository.GetAllNodes(), maxColorsAllowed); var scoringFunction = new LexicographicScoringFunction(_nodeAndArcRepository.GetAllNodes(), maxColorsAllowed); var solution = new GraphColoringSolution(); var firstNode = scoringFunction.GetNewNode(); solutionInfeasible = _searchAlgorithm.SearchFurther(firstNode, 0, domainStore, scoringFunction, solution); if (!solutionInfeasible) { bestSolution = solution; maxColorsAllowed = solution.GetColorsUsed(); } //solutionInfeasible = true; } return(bestSolution); }