Package org.jquantlib.math.optimization

Examples of org.jquantlib.math.optimization.LevenbergMarquardt


    {
        switch(optimizationMethodType){
        case simplex:
            return new Simplex(simplexLambda);
        case levenbergMarquardt:
            return new LevenbergMarquardt(levenbergMarquardtEpsfcn,
                    levenbergMarquardtXtol,
                    levenbergMarquardtXtol);
        default:
            throw new IllegalArgumentException("unknown Optimization Method type");
        }
View Full Code Here


            if (! validCurve) {
                data[i+1] = data[i];
            }
        }

        final LevenbergMarquardt solver = new LevenbergMarquardt (ts.accuracy(), ts.accuracy(), ts.accuracy());

        final EndCriteria endCriteria = new EndCriteria (100, 10, 0.00, ts.accuracy(), 0.00);
        final Constraint solverConstraint = (forcePositive ? new PositiveConstraint() : new NoConstraint());
        int i = localisation -1;
        //FIXME, convexmonotone interpolation?
        final int dataAdjust = 1;

        for (; i < nInsts; ++ i) {
            final int initialDataPoint = i + 1 - localisation + dataAdjust;
            final double startArray[] = new double[localisation+1-dataAdjust];
            for (int j=0; j < startArray.length-1; ++j) {
                startArray[j] = data[initialDataPoint+j];

                // here we are extending the interpolation a point at a
                // time... but the local interpolator can make an
                // approximation for the final localisation period.
                // e.g. if the localisation is 2, then the first section
                // of the curve will be solved using the first 2
                // instruments... with the local interpolator making
                // suitable boundary conditions.

                /*
                           ts_->interpolation_ =
                               ts_->interpolator_.localInterpolate(
                                                    ts_->times_.begin(),
                                              ts_->times_.begin()+(iInst + 2),
                                              ts_->data_.begin(),
                                              localisation_,
                                              ts_->interpolation_,
                                              nInsts+1);
                */
                //bootstrapable.getInterpolation ().update ();

                ts.setInterpolation(interpolator.interpolate(new Array(times, i+2), new Array(data)));

                if (i >= localisation) {
                    startArray[localisation-dataAdjust] = traits.guess(ts, dates[i]);
                } else {
                    startArray[localisation-dataAdjust] = data[0];
                }

                final PenaltyFunction currentCost = new PenaltyFunction(initialDataPoint, (i - localisation + 1), (i + 1));

                final Problem toSolve = new Problem(currentCost, solverConstraint, new Array(startArray));
                final EndCriteria.Type endType = solver.minimize (toSolve, endCriteria);

                QL.require (endType == EndCriteria.Type.StationaryFunctionAccuracy ||
                            endType == EndCriteria.Type.StationaryFunctionValue,
                            "Unable to strip yieldcurve to required accuracy");
            }
View Full Code Here

        final double calibrationTolerance = 5.0e-8;
        // initialize optimization methods
        final OptimizationMethod methods[] = new OptimizationMethod[2];
        methods[0] = new Simplex(0.01);
        methods[1] = new LevenbergMarquardt(1e-8, 1e-8, 1e-8);
        // Initialize end criteria
        final EndCriteria endCriteria = new EndCriteria(100000, 100, 1e-8, 1e-8, 1e-8);

        // Test looping over all possibilities
        for (int j=0; j<methods.length; ++j) {
View Full Code Here

        final double calibrationTolerance = 5.0e-8;
        // initialize optimization methods
        final OptimizationMethod methods[] = new OptimizationMethod[2];
        methods[0] = new Simplex(0.01);
        methods[1] = new LevenbergMarquardt(1e-8, 1e-8, 1e-8);
        // Initialize end criteria
        final EndCriteria endCriteria = new EndCriteria(100000, 100, 1e-8, 1e-8, 1e-8);

        // Test looping over all possibilities
        for (int j=0; j<methods.length; ++j) {
View Full Code Here

       
       
       
       

        final LevenbergMarquardt solver = new LevenbergMarquardt(ts_.accuracy(), ts_.accuracy(), ts_.accuracy());
        final EndCriteria endCriteria = new EndCriteria(100, 10, 0.00, ts_.accuracy(), 0.00);
        final Constraint solverConstraint = forcePositive_ ? new PositiveConstraint() : new NoConstraint();

        // now start the bootstrapping.
        /*Size*/ final int iInst = localisation_-1;
View Full Code Here

        final double calibrationTolerance = 5.0e-8;
        // initialize optimization methods
        final List<OptimizationMethod> methods_ = new ArrayList<OptimizationMethod>();
        methods_.add(new Simplex(0.01));
        methods_.add(new LevenbergMarquardt(1e-8, 1e-8, 1e-8));
        // Initialize end criteria
        final EndCriteria endCriteria = new EndCriteria(100000, 100, 1e-8, 1e-8, 1e-8);
        // Test looping over all possibilities
        for (int j=0; j<methods_.size(); ++j) {
          for (int i=0; i<vegaWeighted.length; ++i) {
View Full Code Here

    {
        switch(optimizationMethodType){
        case simplex:
            return new Simplex(simplexLambda);
        case levenbergMarquardt:
            return new LevenbergMarquardt(levenbergMarquardtEpsfcn,
                    levenbergMarquardtXtol,
                    levenbergMarquardtXtol);
        default:
            throw new IllegalArgumentException("unknown Optimization Method type");
        }
View Full Code Here

TOP

Related Classes of org.jquantlib.math.optimization.LevenbergMarquardt

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.