Optimizing Adaptive Experiments: A Unified Approach to Regret Minimization and Best-Arm Identification