The problem of optimizing the transition from open-pit to underground mining remains a challenge within the field of mining engineering, with far-reaching implications for sustainable development. Several researchers have tackled this transition problem, primarily focusing on maximizing project profitability while grappling with the complexities associated with solving it for real large-scale ore deposits. This study presents a mixed integer programming model that accounts for costs associated with preventing, mitigating, or compensating for adverse environmental impacts on net present value (NPV). Then, a Python-based code was developed using the Divide and Conquer algorithm, with the goal of reducing various operational modes and boosting solver speed to overcome the limitations encountered in the existing literature, particularly when dealing with large-scale deposits. The developed solution aims to transform a block model with varying dimensions into a selective mining unit with uniform dimensions, align the pushback's size and location with the mine's depth, length, and width, convert the matrix into a functional format, and clear previous calculations and results upon achieving the maximum NPV in the new phase. The study also evaluated the environmental impact on the transition problem using this methodology, applying it to the Sungun large-scale copper deposit. The results favor a sequential combined mining approach, yielding an NPV of 7.51 billion USD at a transition depth of 887.5 m with environmental costs included, and 7.61 billion USD at a depth of 950 m without environmental cost considerations.