Safe Learning in Tree-Form Sequential Decision Making: Handling Hard and Soft Constraints