A method to jointly learn both cost function and constraints from human demonstrations, enabling robots to replicate tasks while ensuring efficiency and safety.