optime evaluates on the tree and replaces constants