public void Create_NewAStarSnake()
        {
            World    w             = new World(4, 2);
            var      heuristicFunc = new SnakeNoneHeuristic();
            Snake    snake         = new Snake(w, 0, heuristicFunc);
            DfBnbMax astar         = new DfBnbMax(snake, new ImplicitGoal());

            Assert.IsNotNull(astar);
        }
        public void Create_NewDfBnbGrid4X4WithBlocked16_FindPath()
        {
            GridSearchNode initialState = _basicWorld4X416.GetInitialSearchNode <GridSearchNode>();
            Solver         solver       = new DfBnbMax(initialState, new GoalOnLocation(_basicWorld4X416.Goal));

            Assert.IsNotNull(solver);
            solver.Run(Int32.MaxValue);
            var maxGoal = solver.GetMaxGoal();

            Assert.AreEqual(10, maxGoal.g);
        }
        public void Create_NewDfBnbGrid3X3_findPath()
        {
            GridSearchNode initialState = _basicWorld3X3.GetInitialSearchNode <GridSearchNode>();
            Solver         solver       = new DfBnbMax(initialState, new GoalOnLocation(_basicWorld3X3.Goal));

            Assert.IsNotNull(solver);
            solver.Run(Int32.MaxValue); //Prevent stoping by time, should stop only when goal found
            var maxGoal = solver.GetMaxGoal();

            Assert.AreEqual(8, maxGoal.g);
        }
        public void Basic_Hbsd_findPathDfBnB()
        {
            GridSearchNode  initialState   = _basicBlocked5X5World.GetInitialSearchNode <GridSearchNode>();
            IPrunningMethod prunningMethod = new HashedBasicSymmetryDetectionPrunning();
            Solver          solver         = new DfBnbMax(initialState, prunningMethod, new GoalOnLocation(_basicBlocked5X5World.Goal));

            Assert.IsNotNull(solver);
            solver.Run(Int32.MaxValue); //Prevent stoping by time, should stop only when goal found
            var maxGoal = solver.GetMaxGoal();

            Assert.AreEqual(20, maxGoal.g);
        }
        public void Run_NewAStarSnake()
        {
            World    w             = new World(5, 3);
            var      heuristicFunc = new SnakeNoneHeuristic();
            Snake    snake         = new Snake(w, 0, heuristicFunc);
            DfBnbMax dfBnbMax      = new DfBnbMax(snake, new ImplicitGoal());

            dfBnbMax.Run(1);
            var maxGoal = dfBnbMax.GetMaxGoal();

            Assert.IsNotNull(maxGoal);
        }
        public void Run_NewAStarBox()
        {
            World w             = new World(5, 2, 2);
            var   heuristicFunc = new SnakeNoneHeuristic();

            int[]    snakeHeads = new int[] { 0, 31 };
            BoxOD    b          = new BoxOD(w, snakeHeads, new BoxNoneHeuristic(), heuristicFunc);
            DfBnbMax dfBnbMax   = new DfBnbMax(b, new ImplicitGoal());

            dfBnbMax.Run(1);
            var maxGoal = dfBnbMax.GetMaxGoal();

            Assert.IsNotNull(maxGoal);
        }
Example #7
0
 public void Compare_AStar_To_DfBNB()
 {
     foreach (var world in _worlds)
     {
         AStarMax astar = new AStarMax(world.GetInitialSearchNode <GridSearchNode>(), new GoalOnLocation(world.Goal));
         Assert.IsNotNull(astar);
         astar.Run(Int32.MaxValue);
         var      AstarMaxGoal = astar.GetMaxGoal();
         DfBnbMax dfbnb        = new DfBnbMax(world.GetInitialSearchNode <GridSearchNode>(), new GoalOnLocation(world.Goal));
         Assert.IsNotNull(dfbnb);
         dfbnb.Run(Int32.MaxValue);
         var DfbnbMaxGoal = dfbnb.GetMaxGoal();
         Assert.AreEqual(AstarMaxGoal.g, DfbnbMaxGoal.g);
     }
 }
Example #8
0
        public void Integration_altbccWithRsdBug_ShouldFindSolution()
        {
            _specialCase01 = new World(File.ReadAllText(@"..\..\altbcc-rsd-bug001.grd"), new AlternateStepsBiconnectedComponentsHeuristic());
            var      prune = new ReachableSymmetryDetectionPrunning();
            AStarMax astar = new AStarMax(_specialCase01.GetInitialSearchNode <RsdGridSearchNode>(), prune, new GoalOnLocation(_specialCase01.Goal));

            Assert.IsNotNull(astar);
            prune.setAstarOpenList(astar.OpenList);
            astar.Run(Int32.MaxValue);
            var      AstarMaxGoal = astar.GetMaxGoal();
            DfBnbMax dfbnb        = new DfBnbMax(_specialCase01.GetInitialSearchNode <GridSearchNode>(), new GoalOnLocation(_specialCase01.Goal));

            Assert.IsNotNull(dfbnb);
            dfbnb.Run(Int32.MaxValue);
            var DfbnbMaxGoal = dfbnb.GetMaxGoal();

            Assert.AreEqual(AstarMaxGoal.g, DfbnbMaxGoal.g);
        }
Example #9
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine(@"Please Provide arguments to run:");
                Console.WriteLine(@"all args should be in the form of: [key]=[value] with space between them");
                Console.WriteLine(@"Arguments:");
                Console.WriteLine(@"----------");
                Console.WriteLine(@"problem:     problem filename");
                Console.WriteLine(@"time-limit:  limit run time to X minutes (default 120), 0 for no time limit");
                Console.WriteLine(@"alg:         [astar/dfbnb/greedy/greedyloops] the solving algorithm");
                Console.WriteLine(@"heuristic:   [none/untouched/bcc/alternate/altbcc/sepaltbcc] the heuristic being used");
                Console.WriteLine(@"prune:       [none/bsd/rsd/hbsd] pruning technique");
                Console.WriteLine(@"bcc-init:    [true/false] remove non-reachable areas from the graph on init");
                Console.WriteLine(@"----------");
                Console.WriteLine(@"memTest:     if set to true, will not solve nothing, only fill memory");
                Console.WriteLine(@"             allocation to check 64bit issue");
                Console.WriteLine(@"-----------------------------[Version:" + VERSION + "]---------------------------------");
                Console.WriteLine(@"time-limit & bcc-init can be set in app.config XML file");
                return;
            }

            Dictionary <string, string> splitedArgs = ConsoleAppHelper.SplitArguments(args);

            if (splitedArgs.ContainsKey("memtest") && splitedArgs["memtest"].Equals("true"))
            {
                MemTest();
            }
            if (!splitedArgs.ContainsKey("time-limit")) //default time limit
            {
                splitedArgs.Add("time-limit", TIME_LIMIT);
            }

            if (!splitedArgs.ContainsKey("bcc-init")) //default pre-bcc
            {
                splitedArgs.Add("bcc-init", BCC_INIT);
            }

            int  timelimit = Int32.Parse(splitedArgs["time-limit"]);
            bool bccInit   = Boolean.Parse(splitedArgs["bcc-init"]);

            string problemFileName = splitedArgs["problem"];

            IGridHeuristic heuristic;

            if (splitedArgs["heuristic"] == "none")
            {
                heuristic = new NoneHeuristic();
            }
            else if (splitedArgs["heuristic"] == "untouched")
            {
                if (splitedArgs["prune"] == "rsd")
                {
                    heuristic = new RsdUntouchedAroundTheGoalHeuristic();
                }
                else
                {
                    heuristic = new UntouchedAroundTheGoalHeuristic();
                }
            }
            else if (splitedArgs["heuristic"] == "bcc")
            {  //TODO: finish impl. + support RSD
                heuristic = new BiconnectedComponentsHeuristic();
            }
            else if (splitedArgs["heuristic"] == "alternate")
            {
                heuristic = new AlternateStepsHeuristic();
            }
            else if (splitedArgs["heuristic"] == "altbcc")
            {
                heuristic = new AlternateStepsBiconnectedComponentsHeuristic();
            }
            else if (splitedArgs["heuristic"] == "sepaltbcc")
            {
                heuristic = new SeparateAlternateStepsBiconnectedComponentsHeuristic();
            }
            else
            {
                throw new NotImplementedException();
            }

            World world = new World(File.ReadAllText(problemFileName), heuristic);

            IPrunningMethod prune;
            GridSearchNode  initialNode;

            switch (splitedArgs["prune"])
            {
            case "none":
                prune       = new NoPrunning();
                initialNode = world.GetInitialSearchNode <GridSearchNode>();
                break;

            case "bsd":
                prune       = new BasicSymmetryDetectionPrunning();
                initialNode = world.GetInitialSearchNode <GridSearchNode>();
                break;

            case "hbsd":
                prune       = new HashedBasicSymmetryDetectionPrunning();
                initialNode = world.GetInitialSearchNode <GridSearchNode>();
                break;

            case "rsd":
                prune       = new ReachableSymmetryDetectionPrunning();
                initialNode = world.GetInitialSearchNode <RsdGridSearchNode>();
                break;

            default:
                Log.WriteLineIf("Prunning Method: " + splitedArgs["prune"] + " is not supported!", TraceLevel.Error);
                return;
            }

            Solver solver;

            switch (splitedArgs["alg"])
            {
            case "astar":
                solver = new AStarMax(initialNode, prune, new GoalOnLocation(world.Goal));
                break;

            case "dfbnb":
                solver = new DfBnbMax(initialNode, prune, new GoalOnLocation(world.Goal));
                break;

            case "greedy":
                solver = new GreedyMax(initialNode, new GoalOnLocation(world.Goal));
                if (splitedArgs["prune"] != "none")
                {
                    Log.WriteLineIf("Greedy doesn't support pruning!", TraceLevel.Error);
                    return;
                }
                break;

            case "greedyloops":
                solver = new GreedyLoopMax(initialNode, new GoalOnLocation(world.Goal), 50);
                if (splitedArgs["prune"] != "none")
                {
                    Log.WriteLineIf("GreedyLoops doesn't support pruning!", TraceLevel.Error);
                    return;
                }
                break;

            default:
                Log.WriteLineIf("Solver algorithm: " + splitedArgs["alg"] + " is not supported!", TraceLevel.Error);
                return;
            }

            if (splitedArgs["prune"] == "rsd")
            {
                //Sorry but RSD must use AStarMax - DFBnB not supported
                ((ReachableSymmetryDetectionPrunning)prune).setAstarOpenList(((AStarMax)solver).OpenList);
            }

            if (bccInit)
            {
                world.InitBcc();
            }

            Log.WriteLineIf(@"Solviong 2D-Grid problem from file:", TraceLevel.Off);
            Log.WriteLineIf(@"[[Folder:" + Path.GetFileName(Environment.CurrentDirectory) + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[Problem:" + problemFileName + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[Algorithm:" + solver.GetType().Name + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[Heuristic:" + heuristic.GetName() + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[Prunning:" + prune.GetName() + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[BccInit:" + bccInit + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[TimeLimit:" + timelimit + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[Width:" + world.Width + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[Height:" + world.Height + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[TotalLocations:" + world.Height * world.Width + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[TotalFreeLocationsPreBcc:" + ((world.Height * world.Width) - world.TotalBlockedPreBccInit) + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[TotalFreeLocationsPostBcc:" + ((world.Height * world.Width) - world.TotalBlockedPostBccInit) + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[BlockedCountPreBccInit:" + world.TotalBlockedPreBccInit + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[BlockedCountPostBccInit:" + world.TotalBlockedPostBccInit + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[NumberOfEvenLocations:" + AlternateStepsHeuristic.GetNumberOfEvenLocations(world.Width, world.Height) + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[NumberOfOddLocations:" + AlternateStepsHeuristic.GetNumberOfOddLocations(world.Width, world.Height) + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[EvenBlockedCount:" + world.EvenBlocked + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[OddBlockedCount:" + world.OddBlocked + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[EvenFreeCount:" + (AlternateStepsHeuristic.GetNumberOfEvenLocations(world.Width, world.Height) - world.EvenBlocked) + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[OddFreeCount:" + (AlternateStepsHeuristic.GetNumberOfOddLocations(world.Width, world.Height) - world.OddBlocked) + "]]", TraceLevel.Off);

            Log.WriteLineIf(@"[[EvenLocationsPercent:" + (decimal)AlternateStepsHeuristic.GetNumberOfEvenLocations(world.Width, world.Height) / world.LinearSize + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[OddLocationsPercent:" + (decimal)AlternateStepsHeuristic.GetNumberOfOddLocations(world.Width, world.Height) / world.LinearSize + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[EvenBlockedPercent:" + (decimal)world.EvenBlocked / world.LinearSize + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[OddBlockedPercent:" + (decimal)world.OddBlocked / world.LinearSize + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[EvenFreePercent:" + (decimal)(AlternateStepsHeuristic.GetNumberOfEvenLocations(world.Width, world.Height) - world.EvenBlocked) / world.LinearSize + "]]", TraceLevel.Off);
            Log.WriteLineIf(@"[[OddFreePercent:" + (decimal)(AlternateStepsHeuristic.GetNumberOfOddLocations(world.Width, world.Height) - world.OddBlocked) / world.LinearSize + "]]", TraceLevel.Off);

            var   startTime   = DateTime.Now;
            ulong startCycles = NativeMethods.GetThreadCycles();

            var howEnded = solver.Run(timelimit);

            ulong totalCycles = NativeMethods.GetThreadCycles() - startCycles;
            var   totalTime   = DateTime.Now - startTime;
            var   goal        = (GridSearchNode)solver.GetMaxGoal();

            Log.WriteLineIf("[[TotalTime(MS):" + totalTime.TotalMilliseconds + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[CPU Cycles:" + totalCycles + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[Expended:" + solver.Expended + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[Generated:" + solver.Generated + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[AlgPruned:" + solver.AlgPruned + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[ExternalPruned:" + solver.ExternalPruned + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[TotalPruned:" + solver.ExternalPruned + solver.AlgPruned + "]]", TraceLevel.Off);
            if (goal != null)
            {
                Log.WriteLineIf("[[G-Value:" + goal.g + "]]", TraceLevel.Off);
                Log.WriteLineIf("[[GoalBits:" + goal.GetBitsString() + "]]", TraceLevel.Off);
                Log.WriteLineIf("[[Goal:" + goal.GetNodeStringV2() + "]]", TraceLevel.Off);
            }
            else
            {
                Log.WriteLineIf("[[G-Value:" + -1 + "]]", TraceLevel.Off);
                Log.WriteLineIf("[[GoalBits:NOGOAL]]", TraceLevel.Off);
                Log.WriteLineIf("[[Goal:NOGOAL]]", TraceLevel.Off);
            }
            Log.WriteLineIf("[[HowEnded:" + Enum.GetName(typeof(State), howEnded) + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[GridSolverVersion:" + VERSION + "]]", TraceLevel.Off);
        }
Example #10
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                System.Console.WriteLine(@"Please Provide arguments to run:");
                System.Console.WriteLine(@"all args should be in the form of: [key]=[value] with space between them");
                System.Console.WriteLine(@"Arguments:");
                System.Console.WriteLine(@"----------");
                System.Console.WriteLine(@"problem:     [snake/box/box-od] snake is single agent & box is multi-agent");
                System.Console.WriteLine(@"             if you choose box you must provide snakes initial locations");
                System.Console.WriteLine(@"             with arguments Sx=location");
                System.Console.WriteLine(@"Sx:          starting location of snake number x, counting from 0");
                System.Console.WriteLine(@"             when using snake you can have only 1 Sx argument");
                System.Console.WriteLine(@"numOfSnakes: instead of Sx (above arg.), will generate all possible positions");
                System.Console.WriteLine(@"             by using virtual node (box only)");
                System.Console.WriteLine(@"snakeH:      [none/legal/reachable] the snake heuristic");
                System.Console.WriteLine(@"boxH:        [none/snakes-sum/legal/reachable/shortest] the box heuristic");
                System.Console.WriteLine(@"alg:         [astar/dfbnb] the solving algorithm");
                System.Console.WriteLine(@"dim:         the number of dimentions for the problem (N)");
                System.Console.WriteLine(@"snakeSpread: the intra-snake spread (sK)");
                System.Console.WriteLine(@"boxSpread:   the inter-snake spread (bK)");
                System.Console.WriteLine(@"timeLimit:   limit run time to X minutes (default 120), 0 for no time limit");
                System.Console.WriteLine(@"memTest:     if set to true, will not solve nothing, only fill memory");
                System.Console.WriteLine(@"             allocation to check 64bit issue");
                System.Console.WriteLine(@"");
                System.Console.WriteLine(@"Start examples:");
                System.Console.WriteLine(@"---------------");
                System.Console.WriteLine(@"this is how to solve single snake problem with A* (head at 0=(00000))");
                System.Console.WriteLine(@"when the dimention is set to 5 and snake spread is 2:");
                System.Console.WriteLine(@"MaSiB problem=snake S0=0 alg=astar dim=5 snakeSpread=2");
                System.Console.WriteLine(@"");
                System.Console.WriteLine(@"this is how to solve multiple snake problem with A*-OD");
                System.Console.WriteLine(@"when the dimention is set to 7, intra-snake spread is 2");
                System.Console.WriteLine(@"and inter-snake spread is 3, the starting locations are 0-(0000000)");
                System.Console.WriteLine(@"and 127-(1111111) so we have 2 snakes");
                System.Console.WriteLine(@"MaSiB problem=box-od s0=0 s1=127 alg=dfbnb dim=7 snakeSpread=2 boxSpread=3 boxh=snakes-sum snakeh=reachable");
                return;
            }

            Dictionary <string, string> splitedArgs = SplitArguments(args);

            if (splitedArgs.ContainsKey("memtest") && splitedArgs["memtest"].Equals("true"))
            {
                MemTest();
            }

            int n  = Int32.Parse(splitedArgs["dim"]);
            int sk = Int32.Parse(splitedArgs["snakespread"]);
            int bk = 2;

            if (splitedArgs.ContainsKey("boxspread"))
            {
                bk = Int32.Parse(splitedArgs["boxspread"]);
            }
            else
            {
                Log.WriteLineIf("boxSpread not found, setting it to:2", TraceLevel.Warning);
            }

            World           w = new World(n, sk, bk);
            ISibNode        initState;
            ISnakeHeuristic snakeh;
            IBoxHeuristic   boxh;
            Solver          solver;

            if (!splitedArgs.ContainsKey("boxh")) //default boxh
            {
                splitedArgs.Add("boxh", "none");
            }
            switch (splitedArgs["boxh"])
            {
            case "none":
                boxh = new BoxNoneHeuristic();
                break;

            case "snakes-sum":
                boxh = new BoxSnakesSumHeuristic();
                break;

            case "legal":
                boxh = new BoxLegalHeuristic();
                break;

            case "reachable":
                boxh = new BoxReachableHeuristic();
                break;

            case "shortest":
                boxh = new BoxShortestSnakeReachableHeuristic();
                break;

            default:
                Log.WriteLineIf("Box heuristic: " + splitedArgs["boxh"] + " is not supported!", TraceLevel.Error);
                return;
            }

            if (!splitedArgs.ContainsKey("snakeh")) //default snakeh
            {
                splitedArgs.Add("snakeh", "none");
            }
            switch (splitedArgs["snakeh"])
            {
            case "none":
                snakeh = new SnakeNoneHeuristic();
                break;

            case "legal":
                snakeh = new SnakeLegalHeuristic();
                break;

            case "reachable":
                snakeh = new SnakeReachableHeuristic();
                break;

            default:
                Log.WriteLineIf("Snake heuristic: " + splitedArgs["snakeh"] + " is not supported!", TraceLevel.Error);
                return;
            }

            if (!splitedArgs.ContainsKey("timelimit")) //default snakeh
            {
                splitedArgs.Add("timelimit", "120");
            }
            int timelimit = Int32.Parse(splitedArgs["timelimit"]);

            if (splitedArgs["problem"].Equals("snake"))
            {
                initState = new Snake(w, Int32.Parse(splitedArgs["s0"]), snakeh);
            }
            else if (splitedArgs["problem"].StartsWith("box"))
            {
                if (splitedArgs.ContainsKey("numofsnakes"))
                {//virtual node
                    if (splitedArgs["problem"].Equals("box"))
                    {
                        initState = new BoxVirtualNode <BoxCartesian>(w, Int32.Parse(splitedArgs["numofsnakes"]), boxh, snakeh);
                    }
                    else if (splitedArgs["problem"].Equals("box-od"))
                    {
                        initState = new BoxVirtualNode <BoxOD>(w, Int32.Parse(splitedArgs["numofsnakes"]), boxh, snakeh);
                    }
                    else
                    {
                        Log.WriteLineIf("Problem: " + splitedArgs["problem"] + " this box is not supported!", TraceLevel.Error);
                        return;
                    }
                }
                else
                {//User selected start positions
                    List <int> heads = new List <int>();
                    int        i     = 0;
                    while (splitedArgs.ContainsKey("s" + i))
                    {
                        heads.Add(Int32.Parse(splitedArgs["s" + i]));
                        i++;
                    }
                    if (splitedArgs["problem"].Equals("box"))
                    {
                        initState = new BoxCartesian(w, heads.ToArray(), boxh, snakeh);
                    }
                    else if (splitedArgs["problem"].Equals("box-od"))
                    {
                        initState = new BoxOD(w, heads.ToArray(), boxh, snakeh);
                    }
                    else
                    {
                        Log.WriteLineIf("Problem: " + splitedArgs["problem"] + " this box is not supported!", TraceLevel.Error);
                        return;
                    }
                }
            }
            else
            {
                Log.WriteLineIf("Problem: " + splitedArgs["problem"] + " is not supported!", TraceLevel.Error);
                return;
            }


            switch (splitedArgs["alg"])
            {
            case "astar":
                solver = new AStarMax(initState, new ImplicitGoal());
                break;

            case "dfbnb":
                solver = new DfBnbMax(initState, new ImplicitGoal());
                break;

            default:
                Log.WriteLineIf("Solver algorithm: " + splitedArgs["alg"] + " is not supported!", TraceLevel.Error);
                return;
            }

            Log.WriteLineIf(@"Solviong snakes in the box problem:", TraceLevel.Info);
            Log.WriteLineIf(@"[[Algorithm:" + solver.GetType().Name + "]]", TraceLevel.Info);
            Log.WriteLineIf(@"[[Problem:" + splitedArgs["problem"] + "]]", TraceLevel.Info);
            Log.WriteLineIf(@"[[WorldDimentions:" + n + "]]", TraceLevel.Info);
            Log.WriteLineIf(@"[[SnakeSpread:" + sk + "]]", TraceLevel.Info);
            Log.WriteLineIf(@"[[BoxSpread:" + bk + "]]", TraceLevel.Info);
            Log.WriteLineIf(@"[[SnakeHeuristics:" + snakeh.GetType().Name + "]]", TraceLevel.Info);
            Log.WriteLineIf(@"[[BoxHeuristics:" + boxh.GetType().Name + "]]", TraceLevel.Info);
            Log.WriteLineIf(@"[[NumOfSnakes:" + Int32.Parse(splitedArgs["numofsnakes"]) + "]]", TraceLevel.Info);


            var startTime = DateTime.Now;
            var howEnded  = solver.Run(timelimit);
            var totalTime = DateTime.Now - startTime;
            var goal      = (ISibNode)solver.GetMaxGoal();

            Log.WriteLineIf("[[TotalTime(MS):" + totalTime.TotalMilliseconds + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[Expended:" + solver.Expended + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[Generated:" + solver.Generated + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[AlgPruned:" + solver.AlgPruned + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[ExternalPruned:" + solver.ExternalPruned + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[G-Value:" + goal.g + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[GoalBits:" + goal.GetBitsString() + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[Goal:" + goal.GetNodeStringV2() + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[HowEnded:" + Enum.GetName(typeof(State), howEnded) + "]]", TraceLevel.Off);
            var snakeFreeSpots = goal.GetSnakeSpreadFreeSpots();

            Log.WriteLineIf("[[SnakeSpreadFreeSpotsCount:" + snakeFreeSpots.Count + "]]", TraceLevel.Off);
            Log.WriteLineIf("[[SnakeSpreadFreeSpotsPlaces:" + string.Join("-", snakeFreeSpots) + "]]", TraceLevel.Off);
            if (goal is Box)
            {
                var boxFreeSpots = ((Box)goal).GetBoxSpreadFreeSpots();
                Log.WriteLineIf("[[BoxSpreadFreeSpotsCount:" + boxFreeSpots.Count + "]]", TraceLevel.Off);
                Log.WriteLineIf("[[BoxSpreadFreeSpotsPlaces:" + string.Join("-", boxFreeSpots) + "]]", TraceLevel.Off);
            }

            var sLoop = 0;

            while (splitedArgs.ContainsKey("s" + sLoop))
            {
                Log.WriteLineIf("[[S" + sLoop + ":" + splitedArgs["s" + sLoop] + "]]", TraceLevel.Info);
                sLoop++;
            }
        }