Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change penalties to non-negative numbers #424

Merged
merged 1 commit into from
Jan 9, 2022
Merged

Conversation

mgeisler
Copy link
Owner

@mgeisler mgeisler commented Jan 9, 2022

The optimization problem solved by the optimal-fit algorithm is fundamentally an optimization problem where we seek to minimize a penalty cost. It is therefore not sensible to allow negative penalties since all penalties are there to discourage certain features:

  • nline_penalty discourages breaks with more lines than necessary,

  • overflow_penalty discourages lines longer than the line width,

  • short_last_line_penalty discourages short last lines,

  • hyphen_penalty discourages hyphenation

Making this change surfaces the overflow bug behind #247 and #416. This will be fixed next via #421 and this commit can be seen as a way of simplifying that PR.

@mgeisler mgeisler force-pushed the non-negative-penalties branch 2 times, most recently from 8d66f4e to 4a1283a Compare January 9, 2022 09:37
The optimization problem solved by the optimal-fit algorithm is
fundamentally a minimization problem. It is therefore not sensible to
allow negative penalties since all penalties are there to discourage
certain features:

* `nline_penalty` discourages breaks with more lines than necessary,

* `overflow_penalty` discourages lines longer than the line width,

* `short_last_line_penalty` discourages short last lines,

* `hyphen_penalty` discourages hyphenation

Making this change surfaces the overflow bug behind #247 and #416.
This will be fixed next via #421 and this commit can be seen as a way
of simplifying that PR.
@mgeisler mgeisler merged commit ef69cc3 into master Jan 9, 2022
@mgeisler mgeisler deleted the non-negative-penalties branch January 9, 2022 09:43
@github-actions github-actions bot mentioned this pull request Feb 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant