# 問題をナップザック問題として定式化
def knapsack_argument(L1, L2, C1, C2, C_max):
    """
    問題をナップザック問題として定式化する
    収益，劣化ともM1が小さいので，M1を基準として考える
    """
    # 収益λ2－収益λ1のリストを生成
    values = list(map(lambda x, y: x - y, L2, L1))
    # 劣化c2－劣化c1のリストを作成
    weights = list(map(lambda x, y: x - y, C2, C1))
    # C_max から C1の合計を引く
    max_weight = C_max - sum(C1)          
    return values, weights, max_weight
    
values, weights, max_weight = knapsack_argument(L1, L2, C1, C2, C_max)
print(values, weights, max_weight)
# 定式化した問題をQUBOに変換する．
prob = Knapsack(values = values, weights = weights, max_weight = max_weight)
qp = prob.to_quadratic_program()
qp