Changeset 5520


Ignore:
Timestamp:
02/19/11 11:15:50 (11 years ago)
Author:
gkronber
Message:

#1423 Fixed problem with progress reporting and stored quality values in a datatable.

Location:
branches/Algorithms.GradientDescent/HeuristicLab.Algorithms.GradientDescent/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/Algorithms.GradientDescent/HeuristicLab.Algorithms.GradientDescent/3.3/HeuristicLab.Algorithms.GradientDescent.csproj

    r5518 r5520  
    108108      <HintPath>..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.ALGLIB-3.1.0.dll</HintPath>
    109109    </Reference>
     110    <Reference Include="HeuristicLab.Analysis-3.3">
     111      <HintPath>..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Analysis-3.3.dll</HintPath>
     112    </Reference>
    110113    <Reference Include="HeuristicLab.Collections-3.3">
    111114      <HintPath>..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath>
  • branches/Algorithms.GradientDescent/HeuristicLab.Algorithms.GradientDescent/3.3/LevenbergMarquardt.cs

    r5516 r5520  
    108108
    109109      subscopesProcessor.Operator = moveCreator;
    110 
    111 
    112 
    113 
    114110    }
    115111
  • branches/Algorithms.GradientDescent/HeuristicLab.Algorithms.GradientDescent/3.3/LevenbergMarquardtMove.cs

    r5516 r5520  
    3030using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3131using HeuristicLab.Problems.TestFunctions;
     32using HeuristicLab.Analysis;
    3233
    3334namespace HeuristicLab.Algorithms.GradientDescent {
     
    7576      double epsf = 0;
    7677      double epsx = 0;
    77       int maxits = 100;
     78      int maxits = 0;
    7879      double diffstep = .1;
    7980
     
    8283      alglib.minlmstate state;
    8384      alglib.minlmreport report;
    84 
    85       alglib.minlmcreatev(solution.Length, 1, solution, diffstep, out state);
     85     
     86      alglib.minlmcreatev(solution.Length, solution, diffstep, out state);
    8687      alglib.minlmsetcond(state, epsg, epsf, epsx, maxits);
    87       alglib.minlmoptimize(state, CreateCallBack(EvaluatorParameter.ActualValue), ReportProgress, null);
     88      alglib.minlmsetxrep(state, true);
     89      alglib.minlmoptimize(state, CreateCallBack(EvaluatorParameter.ActualValue), CreateReportProgress(ResultParameter.ActualValue), null);
    8890      alglib.minlmresults(state, out solution, out report);
    8991
     
    104106    }
    105107
    106     private void ReportProgress(double[] arg, double func, object obj) {
    107       if (!ResultParameter.ActualValue.ContainsKey(QualityResultsName))
    108         ResultParameter.ActualValue.Add(new Result(QualityResultsName, new DoubleValue()));
     108    private alglib.ndimensional_rep CreateReportProgress(ResultCollection results) {
     109      return (double[] arg, double func, object obj) => {
     110        if (!results.ContainsKey(QualityResultsName)) {
     111          DataTable table = new DataTable(QualityResultsName);
     112          table.Rows.Add(new DataRow("Quality"));
     113          results.Add(new Result(QualityResultsName, table));
     114        }
    109115
    110       ((DoubleValue)ResultParameter.ActualValue[QualityResultsName].Value).Value = func;
     116        DataTable resultsTable = (DataTable)results[QualityResultsName].Value;
     117        resultsTable.Rows["Quality"].Values.Add(func);
     118      };
    111119    }
    112120  }
Note: See TracChangeset for help on using the changeset viewer.