Commit Graph

40 Commits

Author SHA1 Message Date
Jeremy Saklad ac0f6adbef
fix: Correct value requirement of Exhibition buyer 2022-07-26 13:25:45 -05:00
Jeremy Saklad aeaaf77900
feat: Add Exhibition skeleton
This is a transient buyer available during F.F. Gebrandt's Prelapsarian
Exhibition, the estival festival of 2022.

It pays out 110% of skeleton's value.
2022-07-26 12:42:03 -05:00
Jeremy Saklad 92e734d5d2
feat: Implement support for Segmented Ribcage
Segmented Ribcages may be used in several unique ways, including a
special scaling cost that necessitated the bulk of the code changes.
2022-06-03 20:00:09 -05:00
Jeremy Saklad bb21eccca8
feat: Add Segmented Ribcage to appendages
Segmented Ribcages can be used to add more limb slots, but carry a
variety of unusual requirements. In addition to a scaling cost in
Nevercold Brass, they require an unfilled tail slot when applied.

It may be prudent to clean up the partial sum formula using helper
methods in the future, as it currently requires a considerable number of
intermediate terms.

itertools.repeat is now being used to perform exponentiation, rather
than repeating terms directly.
2022-06-03 19:54:34 -05:00
Jeremy Saklad b4319464a1
feat: Add Segmented Ribcage to skulls
This skull is unique for requiring a specific torso style, and for
adding additional limb slots.
2022-06-03 19:54:34 -05:00
Jeremy Saklad 0757dc3275
fix: Include effects of skulls when adding joints
The cost of adding joints is dependent on the current amount, which may
be affected by both the torso and skulls.

The new implementation still ignores the effects of other Appendage
actions, since joints may be added before doing anything else. This may
warrant revisiting in the future.
2022-05-26 08:12:34 -06:00
Jeremy Saklad aa6a294d55
feat: Add segment property to actions
This is used to track the number of segments in a skeleton, which
is affected by a new bone.
2022-05-26 06:55:02 -06:00
Jeremy Saklad 57a2e9ce36
fix: Restore default number of workers
OR-Tools 9.3 no longer seems to use more than one worker by default, so
this parameter is once again set by the script.

The parameter has also been changed from num_search_workers to
num_workers internally, though the former is mapped to the latter.
2022-04-19 10:02:03 -05:00
Jeremy Saklad 8cb2ba5676
Update OR-Tools to 9.3
Despite being a minor version, OR-Tools 9.3 has breaking changes to
CP-SAT in the form of renamed methods.
2022-04-11 13:38:25 -05:00
Jeremy Saklad c6ae446fa0
Add leg fascination to Diplomat
This fascination works similarly to the skull-based fascination.
2021-11-02 15:26:08 -05:00
Jeremy Saklad 69cbaeeb48
Remove unnecessary model hints
These hints don't actually improve performance in practice, so they have
no reason to remain.
2021-10-28 00:20:30 -05:00
Jeremy Saklad 6e4a3a0117
Add amphibian fascination for Diplomat
This fascination works similarly to other declaration-based fascinations.
2021-10-28 00:19:39 -05:00
Jeremy Saklad 39df88eedd
Refactor complex buyers
Buyer requirements now use helper methods and control flow to increase
readability and compactness.

The main benefit of this is no longer having to declare intermediate
variables.
2021-10-19 22:20:02 -05:00
Jeremy Saklad 40246c4815
Remove BoneMarketModel.AddDivisionMultiplicationEquality
This function has been obsoleted by the ability to pass partial methods
as parameters to helper functions.

Use of this function has been replaced with partial methods accordingly.

In addition, the following code style has been applied: partial methods that
contain a nested partial method have the function arguments broken into
distinct lines. This means that the bottom partial method is formatted in the
same manner as a partial method without any nesting.
2021-10-16 15:11:12 -05:00
Jeremy Saklad 1175575c92
Remove BoneMarketModel.AddDivisionApproximateExponentiationEquality
This function has been obsoleted by the ability to pass partial methods
as parameters to helper functions.

Use of this function has been replaced with partial methods accordingly.
This has allowed some intermediate variables to be removed entirely,
allowing for further simplification.
2021-10-16 13:14:30 -05:00
Jeremy Saklad fd8abb7501
Update Trifling Diplomat to use new formulae
The Trifling Diplomat fascinations that previously exhibited quasi-cubic
scaling have a new formula using the mean of amalgamy, antiquity, and
menace.

To eliminate unnecessary reptition, all fascinations have been
completely refactored and combined using the new helper methods and design patterns.

A comment has been added to mark The Trifling Diplomat's code, since it
is noticeably less readable than that of other refactored buyers.
2021-10-16 10:28:07 -05:00
Jeremy Saklad b5a047889d
Add menace fascination for Diplomat
This fascination scales quadratically with menace.
2021-10-15 21:39:41 -05:00
Jeremy Saklad 110f524f62
Update OR-Tools to v9.1
This update, despite ostensibly being a minor version, includes breaking
changes that must be accounted for.

Overflow is much more strictly checked, so the magnitude of certain
constants has been decreased.

CP-SAT's default number of workers has been changed to reflect the
default of this script. As such, the script no longer needs to change
that parameter unless a specific number of workers has been specified.

In light of the breaking changes, the OR-Tools version is now pinned at
9.1 instead of being permitted to use future minor versions.
2021-10-15 21:32:55 -05:00
Jeremy Saklad 5a3f4f6454
Refactor simpler buyers
Buyer requirements now use helper methods and control flow to increase
readability and compactness.

The main benefit of this is no longer having to declare intermediate variables directly.

This is a work-in-progress, as some buyers have complex formulae that
necessitate more work or additional helper methods to refactor.
2021-10-15 17:46:13 -05:00
Jeremy Saklad 77db9fef92
Clamp attributes to zero or more
Amalgamy, antiquity, menace, and implausibility are now clamped to be
non-negative. This simplifies a number of calculations, eliminates a few
insiduous calculation errors, and reflects the actual game.

This change impacts the output of the program, which previously showed
negative values even though they weren't actually possible.
2021-10-15 17:12:20 -05:00
Jeremy Saklad 06dd19bb45
Refactor declaration requirements
Declaration requirements now use helper methods and generator
expressions to increase readability and compactness.

Requirements are ordered and grouped by quantity.

The comments on declaration requirements have been removed, as the new
pattern is far easier to read.
2021-10-15 15:04:37 -05:00
Jeremy Saklad 17add382ec
Replace BoneMarketModel.NewIntermediateBoolVar
The replacement method, BoolExpression, accepts a
BoundedLinearExpression directly, and uses memoization to reuse Boolean
variables. This technique is unsuitable for other methods, as
constraints need to be applied separately, but in this case it is fine.

The new method is much easier to understand, and far easier to read at
call sites.

Variable names are generated from the expression, rather than being
explicitly specified.
2021-10-15 15:04:37 -05:00
Jeremy Saklad 3d90d61deb
Replace helper functions with subclass
The new subclass, BoneMarketModel, overrides CpModel's methods with
improvements such as default parameters and support for enforcement
literals.

This should allow substantial improvements to the readability of the
solver in the future.

In addition, various lists have been replaced with tuples where
appropriate.
2021-10-15 15:03:55 -05:00
Jeremy Saklad 5ef972295b
Use f-strings and multiline strings
Inline string expressions are far easier to read, particularly for
complicated strings like the skeleton printer's output.

Care has been taken to ensure that no behavior has been changed in the
process.
2021-09-18 20:01:30 -05:00
Jeremy Saklad 807c3d834c
Add __slots__ to internal printer class
This slightly reduces memory usage.
2021-09-18 19:18:40 -05:00
Jeremy Saklad 3ff1b2fd46
Update quadratic buyers to reflect balance changes
The Investment-Minded Ambassador yields 80% of their former secondary
revenue, while the Tentacled Entrepreneur and Teller of Terrors yield
400% of theirs.
2021-09-11 15:11:01 -05:00
Jeremy Saklad 32531d2b58
Update Teller of Terrors
The Teller now pays quadruple their previous secondary revenue.
2021-09-11 13:03:05 -05:00
Jeremy Saklad 479bad798b
Update Tentacled Entrepreneur
The Entrepreneur now pays quadruple their previous secondary revenue.
2021-09-11 12:46:03 -05:00
Jeremy Saklad e0b070d2eb
Update Investment-Minded Ambassador
The Ambassador now pays four-fifths of their previous secondary revenue.
2021-09-10 20:55:41 -05:00
Jeremy Saklad 8cc1ddc0b5
Decouple Zoological Mania's bonus from value
Zoological Mania's bonus is now saved upon skeleton declaration,
and used when calculating results rather than being added to value
directly.

Not all buyers benefit from the bonus, so this change better reflects
the actual game.

A crash caused by failing to specify Zoological Mania has been fixed.
2021-09-10 14:58:56 -05:00
Jeremy Saklad 0f7eb10da8
Implement menace scaling for Vake skulls
Vake skulls now have diminishing returns beyond the first skull.

Menace calculation has been reorganized to accomodate the change.

Vake skulls are no longer capped, as the new scaling has been fully
implemented.
2021-09-01 14:04:18 -05:00
Jeremy Saklad ebd2c2fc48
Implement scaling implausibility for Vake skulls
Vake skulls now have scaling implausibility, which is calculated using a
partial sum formula.

Implausibility calculation has been reorganized to accomodate the
change.
2021-09-01 13:21:47 -05:00
Jeremy Saklad 5d7c972169
Implement scaling value for Vake skulls
Vake skulls now have diminishing returns beyond the first skull, which
are calculated using a partial sum formula similar to joint addition.

Value calculation has been reorganized to accomodate the change.
2021-09-01 12:03:53 -05:00
Jeremy Saklad abd5139aad
Limit Vake skulls to 1 temporarily
Vake skulls are now nerfed when using more than one. Until the
diminishing returns are understood, this script will now use only 1 at
most.
2021-09-01 07:23:33 -05:00
Jeremy Saklad b2a98cbe15
Add reptile fascination for Diplomat
This fascination effectively requires a Reptile declaration, and scales
with all three skeleton attributes multiplied together.
2021-08-24 07:27:54 -05:00
Jeremy Saklad dabf0ff4d7
Add blacklist parameter to solver
Enum members in this dictionary are disallowed by the solver.

The types that can be blacklisted have been added to __all__ in
solve.py.
2021-08-13 09:03:14 -05:00
Jeremy Saklad 4ef31a9cca
Fix warm amber calculation
The cost was inaccurately multiplied by the number of joint additions
before.

Credit to 34Witches in the FBG Discord for diagnosing the problem.
2021-08-12 21:38:07 -05:00
Jeremy Saklad 90b769230b
Add skulls fascination for Diplomat
This fascination scales with all three skeleton attributes multiplied together.
2021-08-11 18:35:15 -05:00
Jeremy Saklad 06df9e6304
Add amalgamy fascination for Diplomat
This fascination scales with the amount of amalgamy on the skeleton.
2021-08-03 15:34:37 -05:00
Jeremy Saklad 84c62aa3c6
Convert project to package
All scripts are now contained in a package named "bonemarketsolver".

The command-line interface has been moved to __main__.py.

The solver script has been moved to solve.py.

Relative module imports are now used where appropriate.

The invocation method of the CLI has changed: instead of running Python
itself, you can now use "pipenv run bone_market_solver".

The README has been updated to reflect the new usage method.
2021-08-03 14:48:42 -05:00