示例#1
0
        private void Search()
        {
            int seed = 2; //This is a good seed to show the crash

            /* Assigning first tools */
            DecisionBuilder myToolAssignmentPhase =
                new RandomSelectToolHeuristic(this, seed);

            /* Ranking of the tools */
            DecisionBuilder sequencingPhase =
                solver.MakePhase(allToolSequences, Solver.SEQUENCE_DEFAULT);

            /* Then fixing time of tasks as early as possible */
            DecisionBuilder timingPhase = solver.MakePhase(
                makespan, Solver.CHOOSE_FIRST_UNBOUND, Solver.ASSIGN_MIN_VALUE);

            /* Overall phase */
            DecisionBuilder mainPhase =
                solver.Compose(myToolAssignmentPhase, sequencingPhase, timingPhase);

            /* Logging */
            const int     logFrequency = 1000000;
            SearchMonitor searchLog    = solver.MakeSearchLog(logFrequency, objective);

            /* Restarts */
            SearchMonitor searchRestart = solver.MakeLubyRestart(100);

            /* Search Limit in ms */
            SearchLimit limit = solver.MakeTimeLimit(180 * 1000);

            /* Collecting best solution */
            SolutionCollector collector = solver.MakeLastSolutionCollector();

            collector.AddObjective(makespan);

            //collector.Add( pile.ToArray() );
            solver.NewSearch(mainPhase, searchLog, searchRestart, objective, limit);
            while (solver.NextSolution())
            {
                Console.WriteLine("MAKESPAN: " + makespan.Value());
            }
        }
示例#2
0
  private void Search(){
    int seed = 2; //This is a good seed to show the crash

    /* Assigning first tools */
    DecisionBuilder myToolAssignmentPhase =
        new RandomSelectToolHeuristic(this, seed);

    /* Ranking of the tools */
    DecisionBuilder sequencingPhase =
        solver.MakePhase(allToolSequences, Solver.SEQUENCE_DEFAULT);

    /* Then fixing time of tasks as early as possible */
    DecisionBuilder timingPhase = solver.MakePhase(
        makespan, Solver.CHOOSE_FIRST_UNBOUND, Solver.ASSIGN_MIN_VALUE);

    /* Overall phase */
    DecisionBuilder mainPhase =
        solver.Compose(myToolAssignmentPhase, sequencingPhase, timingPhase);

    /* Logging */
    const int logFrequency = 1000000;
    SearchMonitor searchLog = solver.MakeSearchLog(logFrequency, objective);

    /* Restarts */
    SearchMonitor searchRestart = solver.MakeLubyRestart(100);

    /* Search Limit in ms */
    SearchLimit limit = solver.MakeTimeLimit(180*1000);

    /* Collecting best solution */
    SolutionCollector collector = solver.MakeLastSolutionCollector();
    collector.AddObjective(makespan);

    //collector.Add( pile.ToArray() );
    solver.NewSearch(mainPhase, searchLog, searchRestart, objective, limit);
    while (solver.NextSolution()){
      Console.WriteLine("MAKESPAN: " + makespan.Value());
    }
  }