Physical Inference for Optimization and Design