目的関数の定義(Objective Function)
$$
\text{Score} = \frac{\text{Comfort} \times \text{Reaction Weight}}{\text{Price} \times \text{Wear Time}}
$$
🔸 各変数の意味
項目 | 記号表現 | 値の例 | 備考 |
---|---|---|---|
快適さ | $C$ | $C \in {10,\ 25,\ 50}$ | 小さいほど不快、大きいほど快適 |
相手の反応重み | $R$ | $R \in {0,\ 50,\ 100}$ | 相手の評価に基づく重み付け |
価格 | $P$ | $P \in [5000,\ 15000]$ | 円単位 |
着用時間 | $T$ | $T \in [5,\ 30]$ | 分単位 |
目的関数の数式展開
$$
\text{Score}(C, R, P, T) = \frac{C \cdot R}{P \cdot T}
$$
- 最大化したい: $\text{Score}$
- 固定・選択パラメータ: $C, R$ はユーザーや相手によって変化(ヒューリスティック or フィードバックにより変動)
- 設計可能な変数: $P, T$ は比較的自分で調整可能なコストや条件(制約付き)
# -*- coding: utf-8 -*-
# Program Name: objective_function_P1000_T10.py
# 固定された価格と着用時間に基づいてスコアを計算する(快適さと反応の組み合わせ)
import pandas as pd
# --- 固定パラメータ / Fixed parameters ---
P = 1000 # 価格(円) / Price in yen
T = 10 # 着用時間(分) / Wear time in minutes
# --- 可変パラメータ / Comfort & Reaction levels ---
comfort_values = [10, 25, 50] # 快適さ C
reaction_weights = [0, 50, 100] # 反応重み R
# --- スコア関数 / Objective function ---
def compute_score(C, R, P, T):
return (C * R) / (P * T)
# --- 計算 / Compute all combinations ---
results = []
for C in comfort_values:
for R in reaction_weights:
score = compute_score(C, R, P, T)
results.append({
'Comfort (C)': C,
'Reaction (R)': R,
'Price (P)': P,
'Wear Time (T)': T,
'Score': round(score, 6)
})
# --- 結果表示 / Display result table ---
df = pd.DataFrame(results)
df_sorted = df.sort_values(by="Score", ascending=False)
from IPython.display import display
print("Score results (P = 1000 yen, T = 10 min):")
display(df_sorted)