File size: 12,734 Bytes
2515793
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<!doctype html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>次日排片最优化(独立站)</title>
  <link rel="stylesheet" href="/static/styles.css">
</head>
<body>
  <main class="container">
    <header class="page-head">
      <h1>🎬 次日排片最优化(随机贪心构造 + 蒙特卡洛评估)</h1>
      <p>按规则自动生成次日排片。硬性规则不满足直接淘汰,软性规则按评分排序,输出 Top10 方案和甘特图。</p>
    </header>

    <section class="panel">
      <h2>日期与参数</h2>
      <div class="row row-3">
        <label class="field">
          <span>基准日期(默认今天)</span>
          <input id="base_date" type="date">
        </label>
        <div class="field readonly">
          <span>目标日期</span>
          <div id="target_date_tip" class="tip">-</div>
        </div>
        <div class="actions inline-end">
          <button id="save_cfg_btn" type="button" class="btn secondary">保存参数</button>
          <button id="reset_cfg_btn" type="button" class="btn secondary">恢复默认参数</button>
          <button id="load_data_btn" type="button" class="btn primary">加载数据并生成可编辑微调约束</button>
        </div>
      </div>

      <div class="grid-3">
        <section class="subpanel">
          <h3>营业与黄金时段</h3>
          <label class="field"><span>营业开始</span><input id="business_start" type="time"></label>
          <label class="field"><span>营业结束</span><input id="business_end" type="time"></label>
          <label class="field"><span>场次转换基准(分钟)</span><input id="turnaround_base" type="number" min="5" max="40" step="1"></label>
          <label class="field"><span>黄金时段开始</span><input id="golden_start" type="time"></label>
          <label class="field"><span>黄金时段结束</span><input id="golden_end" type="time"></label>
          <label class="field checkbox"><input id="efficiency_enabled" type="checkbox"><span>启用排片效率分析表(18规则)</span></label>
          <label class="field"><span>效率规则扣分系数</span><input id="efficiency_penalty_coef" type="number" min="0.1" max="10" step="0.1"></label>
          <label class="field"><span>效率日增减上限 C</span><input id="eff_daily_delta_cap" type="number" min="0" max="20" step="1"></label>
        </section>

        <section class="subpanel">
          <h3>硬性规则参数</h3>
          <label class="field checkbox"><input id="rule1_enabled" type="checkbox"><span>规则一:同影片最小开场间隔</span></label>
          <label class="field"><span>规则一间隔(分钟)</span><input id="rule1_gap" type="number" min="5" max="180" step="1"></label>

          <label class="field checkbox"><input id="rule4_enabled" type="checkbox"><span>规则四:首末场强约束</span></label>
          <label class="field"><span>最早场不得晚于</span><input id="rule4_earliest" type="time"></label>
          <label class="field"><span>最晚场不得早于</span><input id="rule4_latest" type="time"></label>

          <label class="field checkbox"><input id="rule13_enabled" type="checkbox"><span>规则十三:2/8/9号厅禁3D</span></label>
          <label class="field"><span>禁3D影厅号(逗号分隔)</span><input id="rule13_forbidden_halls" type="text"></label>
          <label class="field"><span>TMS 缺片允许场次数</span><input id="tms_allowance" type="number" min="0" max="50" step="1"></label>
        </section>

        <section class="subpanel">
          <h3>软性规则参数</h3>
          <label class="field checkbox"><input id="rule2_enabled" type="checkbox"><span>规则二:30分钟内开场超阈值</span></label>
          <label class="field"><span>规则二阈值(场)</span><input id="rule2_threshold" type="number" min="1" max="20" step="1"></label>
          <label class="field"><span>规则二窗口(分钟)</span><input id="rule2_window_minutes" type="number" min="5" max="120" step="5"></label>
          <label class="field"><span>规则二每超1场扣分</span><input id="rule2_penalty" type="number" min="1" max="200" step="1"></label>

          <label class="field checkbox"><input id="rule3_enabled" type="checkbox"><span>规则三:场次开场断档扣分</span></label>
          <label class="field"><span>规则三断档阈值(分钟)</span><input id="rule3_gap_minutes" type="number" min="10" max="180" step="5"></label>
          <label class="field"><span>规则三扣分系数</span><input id="rule3_penalty" type="number" min="1" max="100" step="1"></label>

          <label class="field checkbox"><input id="rule9_enabled" type="checkbox"><span>规则九:黄金热门密度</span></label>
          <label class="field"><span>规则九热门TopN</span><input id="rule9_hot_top_n" type="number" min="1" max="10" step="1"></label>
          <label class="field"><span>规则九最小占比</span><input id="rule9_min_ratio" type="number" min="0.05" max="0.9" step="0.05"></label>
          <label class="field"><span>规则九扣分</span><input id="rule9_penalty" type="number" min="1" max="200" step="1"></label>
        </section>
      </div>

      <div class="row row-3">
        <section class="subpanel">
          <h3>规则二豁免时段</h3>
          <label class="field"><span>例如:14:00-15:00, 19:00-20:00</span><textarea id="rule2_exempt_ranges" rows="3"></textarea></label>
        </section>
        <section class="subpanel">
          <h3>规则十一与十二</h3>
          <label class="field checkbox"><input id="rule11_enabled" type="checkbox"><span>规则十一:22:00后热门影片</span></label>
          <label class="field"><span>规则十一起算时间</span><input id="rule11_after_time" type="time"></label>
          <label class="field"><span>规则十一扣分</span><input id="rule11_penalty" type="number" min="1" max="200" step="1"></label>

          <label class="field checkbox"><input id="rule12_enabled" type="checkbox"><span>规则十二:票房Top5需黄金场</span></label>
          <label class="field"><span>规则十二每片扣分</span><input id="rule12_penalty_each" type="number" min="1" max="200" step="1"></label>
        </section>
        <section class="subpanel">
          <h3>计算参数</h3>
          <label class="field"><span>Monte Carlo迭代次数</span><input id="iterations" type="number" min="20" max="100000" step="10"></label>
          <label class="field"><span>随机种子(可复现)</span><input id="random_seed" type="number" min="0" max="99999999" step="1"></label>
        </section>
      </div>

      <section class="subpanel">
        <h3>影厅维护/包场时段</h3>
        <div class="actions"><button id="add_maintenance_btn" type="button" class="btn secondary small">新增一行</button></div>
        <div class="table-wrap">
          <table id="maintenance_table" class="simple-table">
            <thead>
              <tr>
                <th>影厅</th>
                <th>开始(HH:MM)</th>
                <th>结束(HH:MM)</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody></tbody>
          </table>
        </div>
      </section>
    </section>

    <section id="loaded_section" class="panel hidden">
      <h2>微调约束与后台任务</h2>
      <div id="load_summary" class="tip"></div>

      <details>
        <summary>🗑️ 剔除特殊场次 (包场/无效数据)</summary>
        <div class="actions select-actions">
          <button id="exclude_select_all_btn" type="button" class="btn secondary small">场次全选</button>
          <button id="exclude_select_none_btn" type="button" class="btn secondary small">场次全不选</button>
          <button id="exclude_select_suspected_btn" type="button" class="btn secondary small">仅选疑似特殊</button>
          <button id="exclude_clear_btn" type="button" class="btn secondary small">清空全部剔除条件</button>
        </div>
        <div class="row row-2">
          <label class="field">
            <span>按场次剔除(仅影响效率分析与默认微调建议)</span>
            <select id="exclude_select" multiple size="10"></select>
          </label>
          <label class="field">
            <span>按影片整组剔除</span>
            <select id="exclude_movie_select" multiple size="10"></select>
          </label>
        </div>

        <div class="row row-2">
          <label class="field">
            <span>按影厅整组剔除</span>
            <select id="exclude_hall_select" multiple size="7"></select>
          </label>
          <div class="subpanel compact">
            <h4>快速规则</h4>
            <label class="field checkbox"><input id="exclude_rule_zero_sales" type="checkbox"><span>剔除零票零票房场次</span></label>
            <label class="field checkbox"><input id="exclude_rule_early_morning" type="checkbox"><span>剔除早场(10:00前)</span></label>
            <p class="muted small">建议先点“仅选疑似特殊”,再按影片/影厅微调。</p>
          </div>
        </div>

        <div class="row row-2 align-end">
          <div id="exclude_effect_tip" class="tip"></div>
          <div class="actions inline-start">
            <button id="apply_exclude_btn" type="button" class="btn secondary">应用剔除并重算微调建议</button>
          </div>
        </div>
      </details>

      <h3>微调约束(留空则不生效)</h3>
      <p class="muted">可按影片设置:最多/最少/固定场次、场次占比范围、黄金场次范围。仅勾选行参与约束。</p>
      <div class="actions select-actions">
        <button id="tuning_select_all_btn" type="button" class="btn secondary small">影片一键全选</button>
        <button id="tuning_select_none_btn" type="button" class="btn secondary small">影片一键全不选</button>
        <button id="tuning_clear_sessions_btn" type="button" class="btn secondary small">场次约束一键清空</button>
        <button id="tuning_clear_ratio_btn" type="button" class="btn secondary small">占比约束一键清空</button>
      </div>
      <div class="table-wrap tuning-wrap">
        <table id="tuning_table" class="simple-table"></table>
      </div>

      <h3>后台运算控制</h3>
      <p class="muted">支持暂停、继续、停止;任务状态实时刷新。</p>

      <div class="metrics" id="job_metrics"></div>
      <div class="progress-wrap"><div id="job_progress_bar"></div></div>
      <div id="job_caption" class="tip"></div>
      <div class="actions">
        <button id="run_btn" type="button" class="btn primary">后台生成 Top10</button>
        <button id="pause_btn" type="button" class="btn secondary">暂停</button>
        <button id="resume_btn" type="button" class="btn secondary">继续</button>
        <button id="stop_btn" type="button" class="btn danger">停止</button>
      </div>

      <div class="row row-2">
        <section>
          <h4>淘汰原因统计(Top)</h4>
          <div class="table-wrap"><table id="reject_reason_table" class="simple-table"></table></div>
        </section>
        <section>
          <h4>淘汰详细统计(Top)</h4>
          <div class="table-wrap"><table id="reject_detail_table" class="simple-table"></table></div>
        </section>
      </div>
    </section>

    <section id="results_section" class="panel hidden">
      <h2>Top10 结果</h2>
      <div id="results_metrics" class="metrics"></div>

      <details>
        <summary>硬性淘汰统计</summary>
        <div class="row row-2">
          <div class="table-wrap"><table id="phase_stats_table" class="simple-table"></table></div>
          <div class="table-wrap"><table id="reason_stats_table" class="simple-table"></table></div>
        </div>
        <div class="table-wrap"><table id="detail_stats_table" class="simple-table"></table></div>
        <pre id="reject_examples" class="code-block"></pre>
      </details>

      <details>
        <summary>影片目标(由效率规则推导)</summary>
        <pre id="movie_targets_json" class="code-block"></pre>
      </details>

      <details>
        <summary>当日效率基准</summary>
        <div class="table-wrap"><table id="today_eff_table" class="simple-table"></table></div>
      </details>

      <div id="candidate_tabs" class="tab-bar"></div>
      <section id="candidate_content"></section>
    </section>

    <div id="message" class="message hidden"></div>
  </main>

  <script src="/static/app.js"></script>
</body>
</html>