Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/26/17 14:12:39 (6 years ago)
Author:
jkarder
Message:

#2205: worked on optimization networks

  • added abstract base classes for ttp networks/orchestrators
  • removed ttp networks/orchestrators from HeuristicLab.Networks.IntegratedOptimization
  • runs can now be cleared when preparing OrchestratedAlgorithmNodes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpOrchestratorNode1.cs

    r14607 r14610  
    6161    int nrOfDepots, nrOfCustomers;
    6262    [Storable]
    63     double[,] depotCoordinates, customerCoordinates;
     63    double[,] depotCoordinates = new double[0, 0], customerCoordinates = new double[0, 0];
    6464    [Storable]
    6565    LrpUtils.DistanceType distanceType;
    6666    [Storable]
    67     double[] depotCapacities, customerDemands, depotCosts;
     67    double[] depotCapacities = new double[0], customerDemands = new double[0], depotCosts = new double[0];
    6868    [Storable]
    6969    double vehicleCapacity, vehicleCost;
     
    187187      foreach (var m in mutator.Operators)
    188188        mutator.Operators.SetItemCheckedState(m, Regex.IsMatch(m.Name, @"Potvin(One|Two).*"));
    189     }
    190 
    191     public override void Prepare() {
     189
     190      Prepare();
     191    }
     192
     193    public override void Prepare(bool clearRuns = false) {
    192194      Results.Clear();
    193195
    194196      var metaMsg = MetaSolverOrchestrationPort.PrepareMessage();
    195       metaMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Prepare | OrchestrationMessage.QualityAdaption);
     197      var msgFlags = OrchestrationMessage.Prepare | OrchestrationMessage.SetEvalHook;
     198      if (clearRuns) msgFlags |= OrchestrationMessage.ClearRuns;
     199      metaMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(msgFlags);
    196200      var problem = new VariegationProblem();
    197201      problem.Encoding.Length = FlpParameter.Value.Encoding.Length * 2;
     
    204208      cts = new CancellationTokenSource();
    205209
    206       try {
    207         var metaMsg = MetaSolverOrchestrationPort.PrepareMessage();
    208         metaMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Start);
    209         MetaSolverOrchestrationPort.SendMessage(metaMsg);
    210       } catch (Exception e) { }
     210      var metaMsg = MetaSolverOrchestrationPort.PrepareMessage();
     211      metaMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Start);
     212      MetaSolverOrchestrationPort.SendMessage(metaMsg);
    211213    }
    212214
     
    272274
    273275      var flpMsg = FlpSolverOrchestrationPort.PrepareMessage();
    274       flpMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Prepare | OrchestrationMessage.Start);
     276      flpMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Prepare | OrchestrationMessage.ClearRuns | OrchestrationMessage.Start);
    275277      flpMsg["Problem"] = flp;
    276278      FlpSolverOrchestrationPort.SendMessage(flpMsg);
     
    279281      var bestFlpSolution = (IntegerVector)flpResults["Best Solution"].Value;
    280282      var flpSolution = FlpParameter.Value.GetSolution(bestFlpSolution);
    281      
     283
    282284      var depots = bestFlpSolution.Select((x, i) => Tuple.Create(x, i)).GroupBy(x => x.Item1, x => x.Item2);
    283285      var vrpSolutions = new ResultCollection(depots.Count());
     
    296298
    297299        var vrpMsg = VrpSolverOrchestrationPort.PrepareMessage();
    298         vrpMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Prepare | OrchestrationMessage.Start);
     300        vrpMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Prepare | OrchestrationMessage.ClearRuns | OrchestrationMessage.Start);
    299301        vrpMsg["Problem"] = vrp;
    300302        VrpSolverOrchestrationPort.SendMessage(vrpMsg);
Note: See TracChangeset for help on using the changeset viewer.