Adding reward functions and terminal functions that are based on logical expressions