dizpers

Nelder-Mead class

Nov 28th, 2011
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. import org.apache.commons.jexl2.*;
  2.  
  3. public class NelderMead {
  4.     // константы
  5.     private static int      M = 3;
  6.     private static double   E = 0.005;
  7.     private static double   A = 1.000;
  8.     private static double   B = 0.500;
  9.     private static double   Y = 2.000;
  10.  
  11.     // переменные
  12.     private JexlEngine jexl;
  13.     private Expression func;
  14.     private String funcString = "";
  15.     private MapContext[] iterations;
  16.  
  17.     public NelderMead(){
  18.         this.jexl = new JexlEngine(null, new FullMath(true), null, null);
  19.     }
  20.  
  21.     public NelderMead(String funcString){
  22.         this.jexl = new JexlEngine(null, new FullMath(true), null, null);
  23.         this.setFunc(funcString);
  24.     }
  25.  
  26.  
  27.     public void setFunc(String funcString){
  28.         this.funcString = funcString;
  29.         this.func = this.jexl.createExpression(funcString);
  30.     }
  31.  
  32.     public Object funcEval(MapContext args){
  33.         return this.func.evaluate(args);
  34.     }
  35.  
  36.     public boolean checkCriterian(){
  37.         return true;
  38.     }
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment