Skip to content

Instantly share code, notes, and snippets.

@gghatano
Created October 2, 2016 09:19
Show Gist options
  • Save gghatano/e16e87c159be5e64bd7acc8f5e0972db to your computer and use it in GitHub Desktop.
Save gghatano/e16e87c159be5e64bd7acc8f5e0972db to your computer and use it in GitHub Desktop.
# 注意
実際には、文字x文字、という表現はできない...
# 変数
xij : binary
xij = 1 : 元データのi行目をj行目とする
# 定数
totalquantity_i : i行目の人の総購入数量
totalprice_i : i行目の人の総購入金額
category_i : i 行目の人のカテゴリ
# 目的関数
U2を最小化する
## カテゴリkのMAE
mae_k =
sum_i toltalquantity_i totalprice_i xij / sum_i (totalquantity_i xij) -
sum_j toltalquantity_j totalprice_i xij / sum_j (totalquantity_j xij)
sum_i category_i xij : category_i の人数
## U2の値
u2 = sum_k mae_k
# 制約
subject to
## 基本的な制約
sum_{i = 1..400} xij = 1 : 元データのi行目を, どこか1行に対応させる
sum_{j = 1..400} xij = 1 : 匿名加工データのj行目を, どこか1行に対応させる
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment