Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/02/18 16:31:42 (6 years ago)
Author:
abeham
Message:

#1614:

  • added additional constraint to benchmark data generator and updated one instance that was affected by this
  • added fitness landscape characteristics for the GQAP
  • fixed RLD analysis view to compensate for empty convergence graphs
  • fixed CPLEX solvers not using the obj value when the solver terminates (callback is not called if proven optimal solution is found)
  • added code for local solver to also check on final quality
Location:
branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/CPLEX/CplexSolver.cs

    r15700 r15713  
    6868        opl.AddDataSource(dataSource);
    6969        opl.Generate();
    70         cplex.Solve();
     70        if (cplex.Solve()) {
     71          var obj = cplex.ObjValue;
     72          if (double.IsNaN(Context.BestQuality) || obj < Context.BestQuality)
     73            Context.BestQuality = obj;
     74          IResult result;
     75          if (Results.TryGetValue("BestQuality", out result))
     76            ((DoubleValue)result.Value).Value = Context.BestQuality;
     77          else Results.Add(new Result("BestQuality", new DoubleValue(Context.BestQuality)));
     78
     79          Context.RunOperator(Analyzer, CancellationToken.None);
     80        }
    7181        cplex.End();
    7282      }
  • branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/LocalSolverNet/GQAPBinarySolver.cs

    r15700 r15713  
    8989
    9090      if (curObj >= prevObj) return;
    91       prevObj = curObj;
    92       Context.BestQuality = curObj;
    93            
     91      UpdateSolution(curObj);
     92
     93      Context.RunOperator(Analyzer, CancellationToken.None);
     94
     95      if (StoppingCriterion()) localSolver.Stop();
     96    }
     97
     98    private void UpdateSolution(double obj) {
     99      IResult result;
     100      prevObj = obj;
     101      Context.BestQuality = obj;
     102
    94103      if (Results.TryGetValue("BestQuality", out result))
    95104        ((DoubleValue)result.Value).Value = Context.BestQuality;
     
    116125        result.Value = Context.BestSolution;
    117126      else Results.Add(new Result("BestSolution", Context.BestSolution));
    118 
    119       Context.RunOperator(Analyzer, CancellationToken.None);
    120 
    121       if (StoppingCriterion()) localSolver.Stop();
    122127    }
    123128
     
    213218        localSolver.Solve();
    214219
     220        var curObj = obj.GetDoubleValue();
     221        if (curObj < prevObj)
     222          UpdateSolution(curObj);
     223
    215224        localSolver.RemoveCallback(LSCallbackType.IterationTicked, LocalSolverOnIterationTicked);
    216225      } finally {
  • branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/LocalSolverNet/GQAPIntegerSolver.cs

    r15700 r15713  
    8888
    8989      if (curObj >= prevObj) return;
    90       prevObj = curObj;
    91       Context.BestQuality = curObj;
    92            
     90      UpdateSolution(curObj);
     91
     92      Context.RunOperator(Analyzer, CancellationToken.None);
     93
     94      if (StoppingCriterion()) localSolver.Stop();
     95    }
     96
     97    private void UpdateSolution(double obj) {
     98      IResult result;
     99      prevObj = obj;
     100      Context.BestQuality = obj;
     101
    93102      if (Results.TryGetValue("BestQuality", out result))
    94103        ((DoubleValue)result.Value).Value = Context.BestQuality;
     
    110119        result.Value = Context.BestSolution;
    111120      else Results.Add(new Result("BestSolution", Context.BestSolution));
    112 
    113       Context.RunOperator(Analyzer, CancellationToken.None);
    114 
    115       if (StoppingCriterion()) localSolver.Stop();
    116121    }
    117122
     
    184189
    185190        localSolver.Solve();
     191
     192        var curObj = obj.GetDoubleValue();
     193        if (curObj < prevObj)
     194          UpdateSolution(curObj);
     195
     196        localSolver.RemoveCallback(LSCallbackType.IterationTicked, LocalSolverOnIterationTicked);
    186197      } finally {
    187198        localSolver.Dispose();
Note: See TracChangeset for help on using the changeset viewer.