A Method for Automatically Optimizing Medical Devices for Treating Heart Failure: Designing Polymeric Injection Patterns