Lilli98 commited on
Commit
69b4277
·
verified ·
1 Parent(s): 7f1bbe4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -5
app.py CHANGED
@@ -140,15 +140,29 @@ def call_llm_for_order(role: str, local_state: dict, info_sharing_visible: bool,
140
  # build prompt (concise)
141
  prompt = (
142
  f"You are the {role.title()} in a 4-player Beer Game (Retailer -> Wholesaler -> Distributor -> Factory).\n"
143
- f"Week: {local_state.get('week')} / {local_state.get('weeks_total')}\n"
144
- f"- Inventory: {inventory}\n"
145
- f"- Backlog: {backlog}\n"
 
 
 
 
146
  f"- Incoming shipment next week: {pipeline_next}\n"
147
  f"- Incoming order this week: {incoming_order}\n"
148
  )
149
  if visible_history:
150
- prompt += f"- Customer demand history (visible): {visible_history}\n"
151
- prompt += "\nDecide a **non-negative integer** order quantity to place to your upstream supplier this week. Reply with an integer only."
 
 
 
 
 
 
 
 
 
 
152
 
153
  try:
154
  resp = openai.ChatCompletion.create(
 
140
  # build prompt (concise)
141
  prompt = (
142
  f"You are the {role.title()} in a 4-player Beer Game (Retailer -> Wholesaler -> Distributor -> Factory).\n"
143
+ f"Your objective is to minimize the **total weekly cost**, defined as:\n"
144
+ f"- Holding cost: $0.50 per unit of positive inventory per week.\n"
145
+ f"- Shortage cost: $1.00 per unit of backlog (unfilled orders) per week.\n\n"
146
+ f"Current state:\n"
147
+ f"- Week: {local_state.get('week')} / {local_state.get('weeks_total')}\n"
148
+ f"- Inventory on hand: {inventory}\n"
149
+ f"- Backlog (unfilled demand): {backlog}\n"
150
  f"- Incoming shipment next week: {pipeline_next}\n"
151
  f"- Incoming order this week: {incoming_order}\n"
152
  )
153
  if visible_history:
154
+ prompt += (
155
+ f"- Recent customer demand history (visible): {visible_history}\n"
156
+ )
157
+
158
+ prompt += (
159
+ "\nWhen deciding your order, consider that orders take time to arrive "
160
+ "(1 week to reach upstream supplier + 2 weeks shipping + 2 weeks production for factory). "
161
+ "Avoid blindly following last week's demand. Try to balance the trade-off between "
162
+ "avoiding stockouts (backlog cost) and avoiding overstock (inventory cost).\n\n"
163
+ "Decide one **non-negative integer** order quantity to place to your upstream supplier "
164
+ "this week to minimize expected total cost. Reply with an integer only."
165
+ )
166
 
167
  try:
168
  resp = openai.ChatCompletion.create(