Wave energy converter control by wave prediction and dynamic programming