use template instead of boost::any
add constraint learning.