Can we rate the whole policy for each slice, rather than line by line
In some cases, rating a multi-line policy is required to be one slice at a time across all lines rather than rating each line independently. For example, one reason for this approach might be because the slice calculation includes discounts that depend on premiums across the entire policy. The default rating approach does not automatically support this requirement.
With additional customization, you can make this change by peforming the following steps.
- Create a new implementation of the rating plugin based on the default rating plugin, or customize the existing rating plugin. The built-in implementation of the rating plugin is the Gosu class gw.plugin.policyperiod.impl.SysTableRatingPlugin.
- Modify the plugin to rearrange the logic of how to calculate slices and call out to the
rating engines for each line. In the ratePeriodImpl method of the
SysTableRatingPlugin class, find the following Gosu
code.
for ( line in period.RepresentativePolicyLines ) { var ratingEngine = createRatingEngine(line) ratingEngine.rate() } - Modify this code to instead iterate across slices instead of by rating engine (iterating across policy lines). The best thing is to review the code for the base class for rating engines, which is the class gw.rating.AbstractRatingEngine. Look at the method implementations for the method rateOnly and the private method rateSlices. You must copy that code or similar code to the rating plugin so that it iterates across each slices. For each slice, iterate across the rating engines for each line of business just like the code that you found in the previous step.
- Additionally, make whatever special rating changes you require, such as the previously-mentioned example of discounts that depend on premiums across the entire policy.
This approach could allow you to get the advantages
of using cost data objects and the AbstractRatingEngine
helper methods, but implement looping the way you want.
