Why do some plants have both chasmogamous and cleistogamous flowers?

Viola (common pansy) and Commelina can produce both chasmogamous and cleistogamous flowers on the same plant. These flowers produce seeds by out-crossing and selfing respectively and the mixed breeding system is considered a successful reproductive strategy.