QLNet.Problem.values C# (CSharp) Метод

values() публичный Метод

public values ( Vector x ) : Vector
x Vector
Результат Vector
        public Vector values(Vector x)
        {
            ++functionEvaluation_;
            return costFunction_.values(x);
        }

Usage Example

Пример #1
0
        //! Calibrate to a set of market instruments (caps/swaptions)

        /*! An additional constraint can be passed which must be
         *  satisfied in addition to the constraints of the model.
         */
        //public void calibrate(List<CalibrationHelper> instruments, OptimizationMethod method, EndCriteria endCriteria,
        //           Constraint constraint = new Constraint(), List<double> weights = new List<double>()) {
        public void calibrate(List <CalibrationHelper> instruments, OptimizationMethod method, EndCriteria endCriteria,
                              Constraint additionalConstraint, List <double> weights)
        {
            if (!(weights.Count == 0 || weights.Count == instruments.Count))
            {
                throw new ApplicationException("mismatch between number of instruments and weights");
            }

            Constraint c;

            if (additionalConstraint.empty())
            {
                c = constraint_;
            }
            else
            {
                c = new CompositeConstraint(constraint_, additionalConstraint);
            }
            List <double>       w = weights.Count == 0 ? new InitializedList <double>(instruments.Count, 1.0): weights;
            CalibrationFunction f = new CalibrationFunction(this, instruments, w);

            Problem prob = new Problem(f, c, parameters());

            shortRateEndCriteria_ = method.minimize(prob, endCriteria);
            Vector result = new Vector(prob.currentValue());

            setParams(result);
            // recheck
            Vector shortRateProblemValues_ = prob.values(result);

            notifyObservers();
        }
All Usage Examples Of QLNet.Problem::values