예제 #1
0
파일: NelderMid.cs 프로젝트: JFFby/OPR-Labs
 public NelderMid(
     MKT_Point startPoint,
     Func<float, float, float> fn,
     SquarePoint[] bounds,
     MktIterationMode iterationMode)
 {
     this.startPoint = startPoint;
     this.fn = fn;
     _points = new List<MKT_Point>();
     this.bounds = bounds;
     currentPoints = new MKT_Point[3];
     maxPoints = iterationMode == MktIterationMode.Full ? 75 : 6;
 }
예제 #2
0
 public HyperCubeWrapper(Func<float,float,float> fn, SquarePoint[] bounds, MktIterationMode iterationMode)
 {
     this.config =  new ShlpHyperCubeConfig
     {
         Fn = fn,
         DeltaSideLenth = 1.1f,
         InnerPointsCount = 5,
         SideLength = 1,
         IterationCount = 15,
         Bounds = bounds,
         IterationMode = iterationMode
     };
 }
예제 #3
0
파일: HyperCube.cs 프로젝트: JFFby/OPR-Labs
 public HyperCube(
     SquarePoint startpoint,
     float sideLength,
     float deltaSideLenth,
     int iterationCount,
     int innerPointsCount,
     SquarePoint[] bounds,
     MktIterationMode iterationMode,
     bool isDebugMode = false)
 {
     this.deltaSideLength = deltaSideLenth;
     this.startPoint = startpoint;
     this.sideLength = sideLength;
     this.iterationCount = iterationMode == MktIterationMode.Full ? iterationCount : 2;
     this.innerPointsCount = innerPointsCount;
     this.isDebugMode = isDebugMode;
     this.bounds = bounds;
 }
예제 #4
0
 public ShlpHyperCube(
     SquarePoint startpoint,
     float sideLength,
     float deltaSideLenth,
     int iterationCount,
     int innerPointsCount,
     SquarePoint[] bounds,
     Func<float, float, float> fn,
     MktIterationMode iterationMode)
     : base(startpoint,
         sideLength,
         deltaSideLenth,
         iterationCount,
         innerPointsCount,
         bounds,
         iterationMode,
         false)
 {
     this.fn = fn;
 }
예제 #5
0
 private IShlpWrapper GetShlp(MktIterationMode iterationMode)
 {
     var type = RandomHelper.Random(1, 10);
     return type % 2 == 0
          ? (IShlpWrapper)new NelderMidWrapper(GlobalSettings.Fn, GlobalSettings.GetBounds(), iterationMode)
          : new HyperCubeWrapper(GlobalSettings.Fn, GlobalSettings.GetBounds(), iterationMode);
 }
예제 #6
0
 private static IShlpWrapper GetShlp(int code, MktIterationMode iterationMode)
 {
     var type = (ShlpType)code;
     switch (type)
     {
         case ShlpType.HyperCube:
             return new HyperCubeWrapper(GlobalSettings.Fn, GlobalSettings.GetBounds(), iterationMode);
         case ShlpType.NelderMid:
             return new NelderMidWrapper(GlobalSettings.Fn, GlobalSettings.GetBounds(), iterationMode);
         default:
             return null;
     }
 }
예제 #7
0
 public NelderMidWrapper(Func<float, float, float> fn, SquarePoint[] bounds, MktIterationMode iterationMode)
 {
     this.fn = fn;
     this.bounds = bounds;
     this.iterationMode = iterationMode;
 }