Exemple #1
0
        //! Solve least square problem using numerix solver
        public Vector perform(ref LeastSquareProblem lsProblem)
        {
            double eps = accuracy_;

            // wrap the least square problem in an optimization function
            LeastSquareFunction lsf = new LeastSquareFunction(lsProblem);

            // define optimization problem
            Problem P = new Problem(lsf, c_, initialValue_);

            // minimize
            EndCriteria ec = new EndCriteria(maxIterations_, Math.Min(maxIterations_ / 2, 100), eps, eps, eps);

            exitFlag_ = (int)om_.minimize(P, ec);

            results_      = P.currentValue();
            resnorm_      = P.functionValue();
            bestAccuracy_ = P.functionValue();

            return(results_);
        }
Exemple #2
0
 //! Default constructor
 public LeastSquareFunction(LeastSquareProblem lsp)
 {
     lsp_ = lsp;
 }
 //! Default constructor
 public LeastSquareFunction(LeastSquareProblem lsp)
 {
     lsp_ = lsp;
 }
        //! Solve least square problem using numerix solver
        public Vector perform(ref LeastSquareProblem lsProblem)
        {
            double eps = accuracy_;

            // wrap the least square problem in an optimization function
            LeastSquareFunction lsf = new LeastSquareFunction(lsProblem);

            // define optimization problem
            Problem P = new Problem(lsf, c_, initialValue_);

            // minimize
            EndCriteria ec = new EndCriteria(maxIterations_, Math.Min((int)(maxIterations_ / 2), (int)(100)), eps, eps, eps);
            exitFlag_ = (int)om_.minimize(P, ec);

            // summarize results of minimization
            //        nbIterations_ = om_->iterationNumber();

            results_ = P.currentValue();
            resnorm_ = P.functionValue();
            bestAccuracy_ = P.functionValue();

            return results_;
        }