calibrationhelper and inflation calibration

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

calibrationhelper and inflation calibration

André de Boer
Hi,

When moving to QuantLib version 1.7.1 we suddenly experience problems
with inflation calibration, error message: 'empty handle cannot be
dereferenced'.

The class InflationCapHelper inherits from CalibrationHelper:

  class InflationCapHelper : public QuantLib::CalibrationHelper {
  public:
   InflationCapHelper(const QuantLib::Date& startDate,
      QuantLib::CapFloor::Type type,
      const QuantLib::Size& years,
      const QuantLib::Period& intervalTime,
      const boost::shared_ptr<QuantLib::InflationIndex>& index,
      QuantLib::Rate strike,
      const QuantLib::Period& forwardStart,
      QuantLib::Real nominal,
      double marketPrice);
   virtual ~InflationCapHelper();
   virtual void addTimesTo(std::list<QuantLib::Time>& times) const;
   virtual QuantLib::Real modelValue() const;
   virtual QuantLib::Real blackPrice(QuantLib::Volatility volatility) const;
  private:
   boost::shared_ptr<InflationCapFloor> inflationDerivative_;
  };

Compared to earlier versions of QuantLib we see that
calibrationhelper.hpp has changed and inherits now from lazyobject in
stead from observer and observable.

How to overcome this issue?

Thnx,
André

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: calibrationhelper and inflation calibration

Peter Caspers-4
Hi Andre,

I just looked up this change (see below), it was introduced in 1.4. I
remember when many observable notifications were sent to calibration
helpers, they could cause a high CPU usage due to many (unnecessary)
black price computations that were done directly in the update()
method before. That's the background.

Would it be possible for you to post the complete code of your
calibration helper implementation, then we can see how to adapt it to
the new base class ?

Regards
Peter

Commit 114b6781a13eae2a99ce89e13387409bc703d323
Author:     Luigi Ballabio <[hidden email]>
AuthorDate: Mon Apr 15 11:55:23 2013 +0000
Precedes:   QuantLib-v1.3 (76) Inherited CalibrationHelper from
LazyObject (thanks to Peter Caspers).




On 23 February 2016 at 16:11, André de Boer <[hidden email]> wrote:

> Hi,
>
> When moving to QuantLib version 1.7.1 we suddenly experience problems
> with inflation calibration, error message: 'empty handle cannot be
> dereferenced'.
>
> The class InflationCapHelper inherits from CalibrationHelper:
>
>   class InflationCapHelper : public QuantLib::CalibrationHelper {
>   public:
>    InflationCapHelper(const QuantLib::Date& startDate,
>       QuantLib::CapFloor::Type type,
>       const QuantLib::Size& years,
>       const QuantLib::Period& intervalTime,
>       const boost::shared_ptr<QuantLib::InflationIndex>& index,
>       QuantLib::Rate strike,
>       const QuantLib::Period& forwardStart,
>       QuantLib::Real nominal,
>       double marketPrice);
>    virtual ~InflationCapHelper();
>    virtual void addTimesTo(std::list<QuantLib::Time>& times) const;
>    virtual QuantLib::Real modelValue() const;
>    virtual QuantLib::Real blackPrice(QuantLib::Volatility volatility) const;
>   private:
>    boost::shared_ptr<InflationCapFloor> inflationDerivative_;
>   };
>
> Compared to earlier versions of QuantLib we see that
> calibrationhelper.hpp has changed and inherits now from lazyobject in
> stead from observer and observable.
>
> How to overcome this issue?
>
> Thnx,
> André
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: calibrationhelper and inflation calibration

Peter Caspers-4
just to close the thread, the issue was solved by implementing a
suitable performCalculations() method in the client class

On 23 February 2016 at 19:24, Peter Caspers <[hidden email]> wrote:

> Hi Andre,
>
> I just looked up this change (see below), it was introduced in 1.4. I
> remember when many observable notifications were sent to calibration
> helpers, they could cause a high CPU usage due to many (unnecessary)
> black price computations that were done directly in the update()
> method before. That's the background.
>
> Would it be possible for you to post the complete code of your
> calibration helper implementation, then we can see how to adapt it to
> the new base class ?
>
> Regards
> Peter
>
> Commit 114b6781a13eae2a99ce89e13387409bc703d323
> Author:     Luigi Ballabio <[hidden email]>
> AuthorDate: Mon Apr 15 11:55:23 2013 +0000
> Precedes:   QuantLib-v1.3 (76) Inherited CalibrationHelper from
> LazyObject (thanks to Peter Caspers).
>
>
>
>
> On 23 February 2016 at 16:11, André de Boer <[hidden email]> wrote:
>> Hi,
>>
>> When moving to QuantLib version 1.7.1 we suddenly experience problems
>> with inflation calibration, error message: 'empty handle cannot be
>> dereferenced'.
>>
>> The class InflationCapHelper inherits from CalibrationHelper:
>>
>>   class InflationCapHelper : public QuantLib::CalibrationHelper {
>>   public:
>>    InflationCapHelper(const QuantLib::Date& startDate,
>>       QuantLib::CapFloor::Type type,
>>       const QuantLib::Size& years,
>>       const QuantLib::Period& intervalTime,
>>       const boost::shared_ptr<QuantLib::InflationIndex>& index,
>>       QuantLib::Rate strike,
>>       const QuantLib::Period& forwardStart,
>>       QuantLib::Real nominal,
>>       double marketPrice);
>>    virtual ~InflationCapHelper();
>>    virtual void addTimesTo(std::list<QuantLib::Time>& times) const;
>>    virtual QuantLib::Real modelValue() const;
>>    virtual QuantLib::Real blackPrice(QuantLib::Volatility volatility) const;
>>   private:
>>    boost::shared_ptr<InflationCapFloor> inflationDerivative_;
>>   };
>>
>> Compared to earlier versions of QuantLib we see that
>> calibrationhelper.hpp has changed and inherits now from lazyobject in
>> stead from observer and observable.
>>
>> How to overcome this issue?
>>
>> Thnx,
>> André
>>
>> ------------------------------------------------------------------------------
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users