Method and apparatus for local resynthesis of logic trees with multiple cost functionsпатент