public void RequestingOrderedCitiesAfterARunAsyncResultsInCorrectOrder()
        {
            bnb = new BranchAndBound(fourCities);
            _   = bnb.RunAsync();
            var expected = orderedCities;
            var actual   = bnb.GetBestScenarioFound();

            Assert.AreEqual(expected[0], actual[0]);
        }
Ejemplo n.º 2
0
        public override ReplState Oparate()
        {
            var solutionPath = ResultsDirPath.CombinePathWith("BranchAndBound_" + DateTime.Now.Ticks);

            Directory.CreateDirectory(solutionPath);
            Graph.WriteToFile(solutionPath.CombinePathWith("Graph.txt"));

            var branchAndBoundSettings = DefaultSettings ? BranchAndBoundSettings <UpperBoundScheme> .Default : GetSettings();
            var branchAndBound         = new BranchAndBound <PartialGraphPartition, GraphPartitionSolution, UpperBoundScheme>(PartialGraphPartition.CreateEmpty(Graph, Random));
            var killTask = DistributedInt.Init();

            branchAndBound.RunAsync(GraphPartitionSolution.GenerateRandom(Graph), branchAndBoundSettings, killTask, ReportSolution(solutionPath), Random);
            return(new PendEndingReplState(killTask));
        }