Changeset 8375 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSMakeStep.cs
- Timestamp:
- 08/01/12 13:46:17 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/BFGSMakeStep.cs
r8371 r8375 35 35 public sealed class BFGSMakeStep : SingleSuccessorOperator { 36 36 private const string TerminationCriterionParameterName = "TerminationCriterion"; 37 private const string HyperparameterParameterName = "Hyperparameter";37 private const string PointParameterName = "Point"; 38 38 private const string BFGSStateParameterName = "BFGSState"; 39 39 … … 45 45 get { return (ILookupParameter<BoolValue>)Parameters[TerminationCriterionParameterName]; } 46 46 } 47 public ILookupParameter<DoubleArray> HyperparameterParameter {48 get { return (ILookupParameter<DoubleArray>)Parameters[ HyperparameterParameterName]; }47 public ILookupParameter<DoubleArray> PointParameter { 48 get { return (ILookupParameter<DoubleArray>)Parameters[PointParameterName]; } 49 49 } 50 50 #endregion … … 52 52 53 53 #region Properties 54 p ublicBFGSState BFGSState { get { return BFGSStateParameter.ActualValue; } }54 private BFGSState BFGSState { get { return BFGSStateParameter.ActualValue; } } 55 55 #endregion 56 56 … … 64 64 // out 65 65 Parameters.Add(new LookupParameter<BoolValue>(TerminationCriterionParameterName, "The termination criterion indicating that the BFGS optimization algorithm should stop.")); 66 Parameters.Add(new LookupParameter<DoubleArray>( HyperparameterParameterName, "The parameters of the function to optimize."));66 Parameters.Add(new LookupParameter<DoubleArray>(PointParameterName, "The next point that should be evaluated in the BFGS algorithm.")); 67 67 } 68 68 … … 73 73 public override IOperation Apply() { 74 74 var state = BFGSState; 75 bool stop= alglib.minlbfgs.minlbfgsiteration(state.State);76 TerminationCriterionParameter.ActualValue = new BoolValue( stop);77 if ( !stop) {78 HyperparameterParameter.ActualValue = new DoubleArray(state.State.x);75 bool @continue = alglib.minlbfgs.minlbfgsiteration(state.State); 76 TerminationCriterionParameter.ActualValue = new BoolValue(!@continue); 77 if (@continue) { 78 PointParameter.ActualValue = new DoubleArray(state.State.x); 79 79 } else { 80 80 double[] x = new double[state.State.x.Length]; 81 81 alglib.minlbfgs.minlbfgsreport rep = new alglib.minlbfgs.minlbfgsreport(); 82 82 alglib.minlbfgs.minlbfgsresults(state.State, ref x, rep); 83 HyperparameterParameter.ActualValue = new DoubleArray(x);83 PointParameter.ActualValue = new DoubleArray(x); 84 84 } 85 85 return base.Apply();
Note: See TracChangeset
for help on using the changeset viewer.