2,619
次編輯
Tankianting(討論 | 貢獻) |
Tankianting(討論 | 貢獻) |
||
行 3: | 行 3: | ||
排版學其實也可以用數學化約之 (to some degree),但是要定 spec。 | 排版學其實也可以用數學化約之 (to some degree),但是要定 spec。 | ||
<math>TotalCost(i) = \begin{cases} min_{j}~TotalCost(j) + LineCost(j, i)~~~~j=0, 1, ..., i-1~~if LineCost(0, i)\end{cases}</math> | <math>TotalCostMain(j) =\begin{cases} min_{0 \leq k < i} TotalCost(k) + 0 * LineCost(k+1, i)~~if~~LineCost(k+1, i) < \infty | ||
= \infty ~~if~~LineCost(k+1, i) = \infty | |||
\end{cases} | |||
</math> | |||
其中<math> LineCost(k+1, i) </math> 是最後一行的成本。 | |||
</math> | |||
<math>TotalCost(i) = \begin{cases} LineCost(0,i)^3~~~~if~~~LineCost(0, i)<\infty \\ | |||
min_{j}~TotalCost(j) + LineCost(j, i)^3~~~~j=0, 1, ..., i-1~~if~~~LineCost(0, i)=\infty | |||
\end{cases}</math> | |||
<math> | <math> | ||
行 9: | 行 22: | ||
\infty ~~~ if~~LineWidth - \sum_{k=j+1}^{i-1} OrigWidth(item[k]) - NewLineWidth(item[i]) < 0 \\ | \infty ~~~ if~~LineWidth - \sum_{k=j+1}^{i-1} OrigWidth(item[k]) - NewLineWidth(item[i]) < 0 \\ | ||
\infty~~if~~NOT~~breakable(item[i]) \\ | \infty~~if~~NOT~~breakable(item[i]) \\ | ||
(LineWidth - \sum_{k=j+1}^{i-1} OrigWidth(item[k]) - NewLineWidth(item[i])) | (LineWidth - \sum_{k=j+1}^{i-1} OrigWidth(item[k]) - NewLineWidth(item[i])) ~~elsewhere | ||
\end{cases} </math> | \end{cases} </math> | ||