当前位置: 首页>>代码示例>>C#>>正文


C# Network.Clone方法代码示例

本文整理汇总了C#中Cream.Network.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Network.Clone方法的具体用法?C# Network.Clone怎么用?C# Network.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cream.Network的用法示例。


在下文中一共展示了Network.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    public static void Main(String[] args)
    {
        Network net = new Network();
        ft06(net);

        String solverName = "ibb";
        int opt = Solver.Minimize;
        long timeout = 180000;
        if (args.Length >= 1)
        {
            solverName = args[0];
        }

        Solver solver;
        if (solverName.Equals("bb"))
        {
            solver = new DefaultSolver(net, opt, "bb");
        }
        else if (solverName.Equals("random"))
        {
            solver = new LocalSearch(net, opt, "rs");
        }
        else if (solverName.Equals("sa"))
        {
            solver = new SimulatedAnneallingSearch(net, opt, "sa");
        }
        else if (solverName.Equals("ibb"))
        {
            solver = new IterativeBranchAndBoundSearch(net, opt, "ibb");
        }
        else if (solverName.Equals("taboo"))
        {
            solver = new TabooSearch(net, opt, "taboo");
        }
        else
        {
            Solver sa = new SimulatedAnneallingSearch((Network)net.Clone(), opt, "sa");
            Solver ibb = new IterativeBranchAndBoundSearch((Network)net.Clone(), opt, "ibb");
            solver = new ParallelSolver(new Solver[] { sa, ibb });
        }
        //Cream.Monitor monitor = new Monitor();
        //monitor.setX(0, (int)(timeout / 1000));
        //solver.setMonitor(monitor);

        Console.Out.WriteLine("Start " + solver + ", timeout = " + timeout + " msecs");

        Solution bestSolution;
        int c = 0;
        if (true)
        {
            for (solver.Start(timeout); solver.WaitNext(); solver.Resume())
            {
                Solution solution = solver.Solution;
                Console.Out.WriteLine(++c);
                Console.Out.WriteLine(solution);
                int value_Renamed = solution.ObjectiveIntValue;
                Console.Out.WriteLine(value_Renamed);
                Console.Out.WriteLine("=======================");
            }
            solver.Stop();
            bestSolution = solver.BestSolution;
        }
        else
        {
            bestSolution = solver.FindBest(timeout);
        }

        Console.Out.WriteLine("Best = " + bestSolution.ObjectiveIntValue);
        Console.Out.WriteLine("Best = " + bestSolution);
        Console.In.ReadLine();
    }
开发者ID:kikoanis,项目名称:CSharpCream,代码行数:71,代码来源:Program.cs


注:本文中的Cream.Network.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。