package com.aps.macroplanner;

import com.google.ortools.Loader;
import com.aps.macroplanner.data.MultiLevelBomTestDataBuilder;
import com.aps.macroplanner.data.TestDataBuilder;

/**
 * 多级BOM + 多成品 + 共享半成品 测试运行器。
 *
 * <p>验证场景:
 * <pre>
 *   P1 ──消耗──→ S1×2.0 + R1×3.0
 *   P2 ──消耗──→ S1×1.0
 *   S1 ──消耗──→ R2×2.0
 * </pre>
 *
 * <p>关键验证:
 * <ol>
 *   <li>多成品 P1(40/天) + P2(30/天) 需求同时满足</li>
 *   <li>共享半成品 S1 总产量 = P1×2.0 + P2×1.0</li>
 *   <li>多级 BOM 展开: R2 消耗 = S1×2.0, R1 消耗 = P1×3.0</li>
 *   <li>需求缺口 = 0</li>
 * </ol>
 */
public class MultiLevelBomTestRunner {
    public static void main(String[] args) {
        Loader.loadNativeLibraries();

        System.out.println("===== MULTI-LEVEL BOM TEST RUNNER START =====");
        System.out.println("BOM: P1→S1×2+R1×3, P2→S1×1, S1→R2×2");
        System.out.println("Demand: P1=40/day, P2=30/day");
        System.out.println();

        TestDataBuilder data = new MultiLevelBomTestDataBuilder();
        System.out.println("Data loaded: " + data.getProducts().size() + " products, "
                + data.getOperations().size() + " operations");
        MacroPlannerOptimizer optimizer = new MacroPlannerOptimizer(data);
        optimizer.buildModel();
        optimizer.solve();
        System.out.println("===== MULTI-LEVEL BOM TEST RUNNER END =====");
    }
}