An Optimization-Based Algorithm for the Construction of Cardiac Purkinje Network Models