{
  "stage": 2,
  "task": "Constrained Customer Selection (Top 10 -> Exact 6)",
  "data_discrepancy_and_constraint_notes": {
    "stage2_data_sheet_discrepancy": "PDF Section 3 states Stage2_Data has operational inputs for the 100 test customers, whereas the workbook sheet Stage2_Data contains 400 rows covering the union of Stage1_Train (300) and Stage1_Test (100). We restrict Stage 2 joins strictly to the 100 Stage1_Test customer_ids and their top-10 ranked candidates.",
    "budget_and_capacity_activity_analysis": "Across all 400 rows in Stage2_Data, contact_cost is in {1, 2, 3, 4}, so for any exact K=6 selection, total contact_cost <= 6 * 4 = 24 < 25 = C (max top-6 sum on this candidate pool is 19 <= 25). Capacity units are in {1, 2, 3, 4} across Stage2_Data so capacity H <= 22 can bind in general (up to 6 * 4 = 24 > 22); on our frozen Stage 1 top-10 candidate pool, the 6 largest candidate capacities sum to 19 <= 22, so our O(N log N) feasibility guard proves all 210 weight-6 subsets are feasible and dispatches the reduced 1-qubit RZ cost separator (0 CX per layer). Whenever capacity or budget can bind on H_6 or a weight-leaking noise model is active, the circuit automatically dispatches the exact 10-qubit positive-part penalty DiagonalGate (verified on a binding capacity counterexample in tests)."
  },
  "constraints": {
    "N_candidates": 10,
    "K_exact_selection": 6,
    "budget_limit_C": 25.0,
    "capacity_limit_H": 22.0
  },
  "top_10_candidates": [
    {
      "customer_id": "C0031",
      "predicted_probability": 0.2979882203218803,
      "rank": 1,
      "top_10_flag": 1,
      "contact_cost": 2,
      "expected_deposit_value": 13,
      "capacity_units": 1,
      "customer_segment": "D",
      "expected_net_value": 1.8738468641844443,
      "qubit_index": 0
    },
    {
      "customer_id": "C0170",
      "predicted_probability": 0.2476515995507443,
      "rank": 2,
      "top_10_flag": 1,
      "contact_cost": 1,
      "expected_deposit_value": 22,
      "capacity_units": 1,
      "customer_segment": "C",
      "expected_net_value": 4.448335190116375,
      "qubit_index": 1
    },
    {
      "customer_id": "C0079",
      "predicted_probability": 0.2401919300152541,
      "rank": 3,
      "top_10_flag": 1,
      "contact_cost": 3,
      "expected_deposit_value": 24,
      "capacity_units": 3,
      "customer_segment": "A",
      "expected_net_value": 2.7646063203660987,
      "qubit_index": 2
    },
    {
      "customer_id": "C0081",
      "predicted_probability": 0.2332437671189136,
      "rank": 4,
      "top_10_flag": 1,
      "contact_cost": 4,
      "expected_deposit_value": 17,
      "capacity_units": 1,
      "customer_segment": "C",
      "expected_net_value": -0.03485595897846894,
      "qubit_index": 3
    },
    {
      "customer_id": "C0193",
      "predicted_probability": 0.2324990671887259,
      "rank": 5,
      "top_10_flag": 1,
      "contact_cost": 3,
      "expected_deposit_value": 16,
      "capacity_units": 1,
      "customer_segment": "D",
      "expected_net_value": 0.7199850750196144,
      "qubit_index": 4
    },
    {
      "customer_id": "C0265",
      "predicted_probability": 0.2146196879868689,
      "rank": 6,
      "top_10_flag": 1,
      "contact_cost": 4,
      "expected_deposit_value": 23,
      "capacity_units": 4,
      "customer_segment": "D",
      "expected_net_value": 0.936252823697985,
      "qubit_index": 5
    },
    {
      "customer_id": "C0188",
      "predicted_probability": 0.2101711592902555,
      "rank": 7,
      "top_10_flag": 1,
      "contact_cost": 2,
      "expected_deposit_value": 13,
      "capacity_units": 2,
      "customer_segment": "B",
      "expected_net_value": 0.7322250707733216,
      "qubit_index": 6
    },
    {
      "customer_id": "C0183",
      "predicted_probability": 0.1995317437348992,
      "rank": 8,
      "top_10_flag": 1,
      "contact_cost": 2,
      "expected_deposit_value": 14,
      "capacity_units": 3,
      "customer_segment": "B",
      "expected_net_value": 0.7934444122885891,
      "qubit_index": 7
    },
    {
      "customer_id": "C0318",
      "predicted_probability": 0.19792520406404,
      "rank": 9,
      "top_10_flag": 1,
      "contact_cost": 3,
      "expected_deposit_value": 21,
      "capacity_units": 3,
      "customer_segment": "A",
      "expected_net_value": 1.1564292853448395,
      "qubit_index": 8
    },
    {
      "customer_id": "C0256",
      "predicted_probability": 0.194275255852506,
      "rank": 10,
      "top_10_flag": 1,
      "contact_cost": 1,
      "expected_deposit_value": 22,
      "capacity_units": 4,
      "customer_segment": "A",
      "expected_net_value": 3.274055628755132,
      "qubit_index": 9
    }
  ],
  "quantum_solution": {
    "solver": "10-Qubit Number-Conserving B\u00e4rtschi\u2013Eidenbenz Dicke State + Guarded RZ / DiagonalGate + Five-Chord XY-QAOA (p=3, ring_plus_5chords)",
    "selected_customer_ids": [
      "C0031",
      "C0170",
      "C0079",
      "C0265",
      "C0318",
      "C0256"
    ],
    "selected_bitstring_little_endian": "1100100111",
    "qubit_to_customer_convention": "Qubit q_i (i=0..9) corresponds to candidate rank i+1. In the 10-character little-endian bitstring 'b9 b8 ... b1 b0', the rightmost bit b0 is q_0.",
    "objective_expected_net_value": 14.453526112464875,
    "total_contact_cost": 14.0,
    "total_capacity_units": 16.0,
    "is_feasible": true,
    "selected_customers_detail": [
      {
        "customer_id": "C0031",
        "predicted_probability": 0.2979882203218803,
        "rank": 1,
        "top_10_flag": 1,
        "contact_cost": 2,
        "expected_deposit_value": 13,
        "capacity_units": 1,
        "customer_segment": "D",
        "expected_net_value": 1.8738468641844443,
        "qubit_index": 0
      },
      {
        "customer_id": "C0170",
        "predicted_probability": 0.2476515995507443,
        "rank": 2,
        "top_10_flag": 1,
        "contact_cost": 1,
        "expected_deposit_value": 22,
        "capacity_units": 1,
        "customer_segment": "C",
        "expected_net_value": 4.448335190116375,
        "qubit_index": 1
      },
      {
        "customer_id": "C0079",
        "predicted_probability": 0.2401919300152541,
        "rank": 3,
        "top_10_flag": 1,
        "contact_cost": 3,
        "expected_deposit_value": 24,
        "capacity_units": 3,
        "customer_segment": "A",
        "expected_net_value": 2.7646063203660987,
        "qubit_index": 2
      },
      {
        "customer_id": "C0265",
        "predicted_probability": 0.2146196879868689,
        "rank": 6,
        "top_10_flag": 1,
        "contact_cost": 4,
        "expected_deposit_value": 23,
        "capacity_units": 4,
        "customer_segment": "D",
        "expected_net_value": 0.936252823697985,
        "qubit_index": 5
      },
      {
        "customer_id": "C0318",
        "predicted_probability": 0.19792520406404,
        "rank": 9,
        "top_10_flag": 1,
        "contact_cost": 3,
        "expected_deposit_value": 21,
        "capacity_units": 3,
        "customer_segment": "A",
        "expected_net_value": 1.1564292853448395,
        "qubit_index": 8
      },
      {
        "customer_id": "C0256",
        "predicted_probability": 0.194275255852506,
        "rank": 10,
        "top_10_flag": 1,
        "contact_cost": 1,
        "expected_deposit_value": 22,
        "capacity_units": 4,
        "customer_segment": "A",
        "expected_net_value": 3.274055628755132,
        "qubit_index": 9
      }
    ]
  },
  "classical_exact_reference": {
    "method": "Exhaustive enumeration of all C(10,6)=210 weight-6 subsets and all 2^10=1024 states",
    "optimal_customer_ids": [
      "C0031",
      "C0170",
      "C0079",
      "C0265",
      "C0318",
      "C0256"
    ],
    "optimal_bitstring_little_endian": "1100100111",
    "optimal_objective_expected_net_value": 14.453526112464875,
    "optimal_total_contact_cost": 14.0,
    "optimal_total_capacity_units": 16.0,
    "total_weight6_subsets": 210,
    "feasible_weight6_subsets": 210,
    "capacity_violating_weight6_subsets": 0,
    "budget_violating_weight6_subsets": 0,
    "top_5_feasible_subsets": [
      {
        "indices": [
          0,
          1,
          2,
          5,
          8,
          9
        ],
        "customer_ids": [
          "C0031",
          "C0170",
          "C0079",
          "C0265",
          "C0318",
          "C0256"
        ],
        "bitstring_le": "1100100111",
        "objective": 14.453526112464875,
        "total_cost": 14.0,
        "total_capacity": 16.0
      },
      {
        "indices": [
          0,
          1,
          2,
          7,
          8,
          9
        ],
        "customer_ids": [
          "C0031",
          "C0170",
          "C0079",
          "C0183",
          "C0318",
          "C0256"
        ],
        "bitstring_le": "1110000111",
        "objective": 14.310717701055479,
        "total_cost": 12.0,
        "total_capacity": 15.0
      },
      {
        "indices": [
          0,
          1,
          2,
          6,
          8,
          9
        ],
        "customer_ids": [
          "C0031",
          "C0170",
          "C0079",
          "C0188",
          "C0318",
          "C0256"
        ],
        "bitstring_le": "1101000111",
        "objective": 14.249498359540212,
        "total_cost": 12.0,
        "total_capacity": 14.0
      },
      {
        "indices": [
          0,
          1,
          2,
          4,
          8,
          9
        ],
        "customer_ids": [
          "C0031",
          "C0170",
          "C0079",
          "C0193",
          "C0318",
          "C0256"
        ],
        "bitstring_le": "1100010111",
        "objective": 14.237258363786506,
        "total_cost": 13.0,
        "total_capacity": 13.0
      },
      {
        "indices": [
          0,
          1,
          2,
          5,
          7,
          9
        ],
        "customer_ids": [
          "C0031",
          "C0170",
          "C0079",
          "C0265",
          "C0183",
          "C0256"
        ],
        "bitstring_le": "1010100111",
        "objective": 14.090541239408623,
        "total_cost": 13.0,
        "total_capacity": 16.0
      }
    ]
  },
  "comparison": {
    "matches_exact_optimum": true,
    "absolute_optimality_gap": 0.0,
    "relative_optimality_gap": 0.0
  },
  "hamiltonian_verification": {
    "num_basis_states_checked": 1024,
    "max_unitary_phase_error_all_1024": 2.944792016369722e-14,
    "max_recovered_energy_diff_all_1024": 2.2737367544323206e-13,
    "min_energy": -14.453526112464875,
    "max_energy": 1800.0,
    "formulation": "Exact positive-part diagonal penalty E(x) = -Z(x) + 50*max(0, sum(h_i x_i)-22)^2 + 50*max(0, sum(c_i x_i)-25)^2 + 50*(sum(x_i)-6)^2 (higher-order diagonal operator, not an equality surrogate)",
    "feasibility_guard_proof_O_N_log_N": {
      "k": 6,
      "max_weight_k_cost_sum": 19.0,
      "budget_limit_c": 25.0,
      "budget_always_satisfied_on_Hk": true,
      "max_weight_k_capacity_sum": 19.0,
      "capacity_limit_h": 22.0,
      "capacity_always_satisfied_on_Hk": true,
      "all_weight_k_subsets_proved_feasible": true
    },
    "guarded_cost_separator_dispatched": "1-qubit prod_i RZ(gamma_l * v_i) (0 CX per layer)",
    "max_prob_diff_guarded_rz_vs_diagonal_gate": 8.326672684688674e-15
  },
  "mixer_verification": {
    "initial_state": "Deterministic B\u00e4rtschi\u2013Eidenbenz Dicke State |D_6^10> = X^{otimes 10} |D_4^10>",
    "mixer_topology": "ring_plus_5chords",
    "mixer_pair_count_per_layer": 15,
    "bartschi_eidenbenz_dicke_statevector_fidelity": 1.0000000000000004,
    "bartschi_eidenbenz_max_prob_error_vs_exact": 9.540979117872439e-18,
    "initial_hamming_weight": 6,
    "probability_in_weight6_after_mixer": 1.0000000000000462,
    "probability_leakage_outside_weight6": 9.771097832477699e-33,
    "conserves_hamming_weight": true
  },
  "quantum_sampling_summary": {
    "simulator_backend": "AerSimulator",
    "shots": 8192,
    "seed_simulator": 42,
    "seed_transpiler": 42,
    "seed_optimizer": 42,
    "optimizer": "COBYLA",
    "num_restarts": 8,
    "maxiter_per_restart": 150,
    "initial_state": "Uniform Dicke State |D_6^10> = (1/sqrt(210)) sum_{|x|=6} |x> prepared via deterministic B\u00e4rtschi\u2013Eidenbenz SCS circuit (uniform probability 1/210 = 0.004762 across all 210 weight-6 subsets)",
    "optimized_gammas": [
      -0.22206246604851193,
      -0.28613112501904303,
      -0.6682867049801638
    ],
    "optimized_betas": [
      0.16836921040520775,
      0.17907264854772173,
      0.12726606216793723
    ],
    "best_expected_penalized_energy": -13.157325588036445,
    "weight6_shot_count": 8192,
    "weight6_shot_probability": 1.0,
    "feasible_shot_count": 8192,
    "feasible_shot_probability": 1.0,
    "optimal_bitstring_shot_count": 553,
    "optimal_bitstring_shot_probability": 0.0675048828125,
    "unique_feasible_bitstrings_sampled": 166,
    "top_measured_bitstrings": [
      {
        "bitstring_little_endian": "1101000111",
        "shots": 843,
        "shot_probability": 0.1029052734375,
        "hamming_weight": 6,
        "is_feasible": true,
        "objective": 14.249498359540212,
        "total_cost": 12.0,
        "total_capacity": 14.0
      },
      {
        "bitstring_little_endian": "1100010111",
        "shots": 698,
        "shot_probability": 0.085205078125,
        "hamming_weight": 6,
        "is_feasible": true,
        "objective": 14.237258363786506,
        "total_cost": 13.0,
        "total_capacity": 13.0
      },
      {
        "bitstring_little_endian": "1100100111",
        "shots": 553,
        "shot_probability": 0.0675048828125,
        "hamming_weight": 6,
        "is_feasible": true,
        "objective": 14.453526112464875,
        "total_cost": 14.0,
        "total_capacity": 16.0
      },
      {
        "bitstring_little_endian": "1101010110",
        "shots": 553,
        "shot_probability": 0.0675048828125,
        "hamming_weight": 6,
        "is_feasible": true,
        "objective": 13.095636570375381,
        "total_cost": 13.0,
        "total_capacity": 14.0
      },
      {
        "bitstring_little_endian": "1010010111",
        "shots": 478,
        "shot_probability": 0.058349609375,
        "hamming_weight": 6,
        "is_feasible": true,
        "objective": 13.874273490730253,
        "total_cost": 12.0,
        "total_capacity": 13.0
      },
      {
        "bitstring_little_endian": "1001010111",
        "shots": 402,
        "shot_probability": 0.049072265625,
        "hamming_weight": 6,
        "is_feasible": true,
        "objective": 13.813054149214988,
        "total_cost": 12.0,
        "total_capacity": 12.0
      },
      {
        "bitstring_little_endian": "1100110110",
        "shots": 397,
        "shot_probability": 0.0484619140625,
        "hamming_weight": 6,
        "is_feasible": true,
        "objective": 13.299664323300044,
        "total_cost": 15.0,
        "total_capacity": 16.0
      },
      {
        "bitstring_little_endian": "1001001111",
        "shots": 331,
        "shot_probability": 0.0404052734375,
        "hamming_weight": 6,
        "is_feasible": true,
        "objective": 13.058213115216903,
        "total_cost": 13.0,
        "total_capacity": 12.0
      },
      {
        "bitstring_little_endian": "1010001111",
        "shots": 318,
        "shot_probability": 0.038818359375,
        "hamming_weight": 6,
        "is_feasible": true,
        "objective": 13.11943245673217,
        "total_cost": 13.0,
        "total_capacity": 13.0
      },
      {
        "bitstring_little_endian": "1110000111",
        "shots": 315,
        "shot_probability": 0.0384521484375,
        "hamming_weight": 6,
        "is_feasible": true,
        "objective": 14.310717701055479,
        "total_cost": 12.0,
        "total_capacity": 15.0
      }
    ],
    "restart_history": [
      {
        "restart": 0,
        "expected_energy": -11.05902518778737,
        "nfev": 150
      },
      {
        "restart": 1,
        "expected_energy": -13.157325588036445,
        "nfev": 150
      },
      {
        "restart": 2,
        "expected_energy": -12.82498589056695,
        "nfev": 150
      },
      {
        "restart": 3,
        "expected_energy": -12.957657213103511,
        "nfev": 150
      },
      {
        "restart": 4,
        "expected_energy": -13.121498326698958,
        "nfev": 150
      },
      {
        "restart": 5,
        "expected_energy": -13.096035146479613,
        "nfev": 150
      },
      {
        "restart": 6,
        "expected_energy": -13.152933588854934,
        "nfev": 150
      },
      {
        "restart": 7,
        "expected_energy": -12.897231309964111,
        "nfev": 150
      }
    ]
  },
  "circuit_resources": {
    "ansatz_type": "10-Qubit Number-Conserving B\u00e4rtschi\u2013Eidenbenz Dicke State + Guarded RZ / DiagonalGate + Five-Chord XY-QAOA (p=3, ring_plus_5chords)",
    "mixer_topology": "ring_plus_5chords",
    "logical_qubits": 10,
    "physical_qubits": "N/A (local AerSimulator; 10 logical qubits)",
    "qaoa_layers_p": 3,
    "guarded_cost_layer_mode": "reduced_1q_rz_product",
    "high_level_depth": 166,
    "high_level_gate_counts": {
      "cx": 102,
      "cry": 72,
      "rxx": 45,
      "ryy": 45,
      "rz": 30,
      "x": 14,
      "measure": 10
    },
    "transpiled_1q2q_depth": 741,
    "transpiled_1q2q_gate_counts": {
      "rz": 648,
      "sx": 498,
      "cx": 426,
      "x": 4
    },
    "one_qubit_gate_count_transpiled": 1150,
    "two_qubit_gate_count_transpiled": 426,
    "swap_count": 0,
    "dicke_state_preparation_overhead_included": {
      "bartschi_eidenbenz_scs_transpiled_cx": 246,
      "bartschi_eidenbenz_scs_transpiled_1q": 590,
      "bartschi_eidenbenz_scs_transpiled_depth": 640,
      "generic_statepreparation_transpiled_cx": 1013,
      "generic_statepreparation_transpiled_1q": 3859,
      "generic_statepreparation_transpiled_depth": 4845,
      "dicke_prep_cx_reduction_pct": 75.71569595261599
    },
    "unreduced_diagonal_reference_comparison": {
      "unreduced_transpiled_cx": 4259,
      "unreduced_transpiled_1q": 7495,
      "unreduced_transpiled_depth": 11034,
      "prior_25chord_unreduced_transpiled_cx": 4379,
      "prior_25chord_unreduced_transpiled_depth": 11199,
      "prior_25chord_guarded_transpiled_cx": 546,
      "prior_25chord_guarded_transpiled_depth": 906,
      "production_transpiled_cx": 426,
      "production_transpiled_1q": 1150,
      "production_transpiled_depth": 741,
      "total_cx_reduction_pct": 89.9976520309932,
      "total_depth_reduction_pct": 93.28439369222403,
      "cx_reduction_vs_prior_4379_pct": 90.27175154144783,
      "depth_reduction_vs_prior_11199_pct": 93.38333779801769,
      "max_1024_state_probability_diff": 8.326672684688674e-15
    },
    "same_budget_mixer_topology_comparison": [
      {
        "topology": "ring_only",
        "pairs_per_layer": 10,
        "expected_energy": -12.491619974209607,
        "optimal_shot_probability": 0.0045166015625,
        "gap": 0.0,
        "cx": 366,
        "depth": 708
      },
      {
        "topology": "ring_plus_5chords",
        "pairs_per_layer": 15,
        "expected_energy": -13.157325588036445,
        "optimal_shot_probability": 0.0675048828125,
        "gap": 0.0,
        "cx": 426,
        "depth": 741
      },
      {
        "topology": "ring_plus_chords_25",
        "pairs_per_layer": 25,
        "expected_energy": -12.725997286967646,
        "optimal_shot_probability": 0.03564453125,
        "gap": 0.0,
        "cx": 546,
        "depth": 906
      }
    ],
    "transpilation_cost_note": "Integrating deterministic B\u00e4rtschi\u2013Eidenbenz Dicke state preparation (246 CX vs 1,013 CX), the O(N log N)-guarded 1-qubit RZ cost separator (0 CX vs 1,022 CX per layer when all 210 weight-6 subsets are proved feasible), and the 5-chord XY mixer (`ring_plus_5chords`, 15 pairs/layer vs 25) reduces full p=3 circuit transpiled CX gates from 4,379 (prior unreduced) / 4259 (same-topology unreduced) to 426 (-90.27% / -90.00%) and depth from 11,199 / 11034 to 741 (-93.38% / -93.28%), while improving expected energy (-13.1573 vs -12.7260) and optimal-bitstring sampling rate (6.75% vs 3.56%) with max probability difference 8.33e-15. Whenever capacity or budget binds on H_6 or a weight-leaking noise model is active, the circuit automatically dispatches the exact 10-qubit positive-part penalty DiagonalGate.",
    "statevector_agreement_error": 7.771561172376096e-16
  },
  "runtime_sec": 1.9758159168995917,
  "environment": {
    "python_executable": "/Users/nafeeskhan/Desktop/atomic hack/.venv/bin/python",
    "python_version": "3.13.13",
    "cwd": "/Users/nafeeskhan/Documents/Codex/2026-11-11/i/outputs/AtomiQ_Submission",
    "platform": "macOS-26.3-arm64-arm-64bit-Mach-O",
    "pid": 25585,
    "package_versions": {
      "numpy": "2.5.4",
      "scipy": "1.18.1",
      "pandas": "3.1.1",
      "openpyxl": "3.1.5",
      "scikit-learn": "1.9.1",
      "qiskit": "2.6.2",
      "qiskit-aer": "0.18.2",
      "matplotlib": "3.11.2",
      "pytest": "9.2.0"
    },
    "seeds": {
      "workbook_sampling_seed": 42,
      "workbook_train_test_split_seed": 42,
      "stage1_cv_and_model_seed": 42,
      "stage2_qaoa_optimizer_and_simulator_seed": 42,
      "stage3_simulator_and_mc_seed": 42
    }
  }
}