✨ add function to calculate item weights by cheapest possible cost #1003
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
It's not used yet in the solver, I couldn't get it to work as I wanted. It also seems to be a little wrong still, since
StitchedIronPlate
, for example, should probably be cheaper than the default recipe for super plates. It may be anapprox
thing, but I haven't looked that deeply into it yet. The alternate weights also ended up producing some wonky solutions in only ways optimizers can; it'd find extremely convoluted solutions that use many different recipes which would end up minimizing the new costs (though, only with non-raw factory inputs, the typical input+maximize still works fine).I added two solver tests to show the issue that I was trying to resolve here. It is an edge case, at any rate.
Note that the changes to the
solver
file are only moving the declarations to a new file.alternate_weights
is the only real new code (some minor alterations otherwise, but only cleanup [moving auxiliary item weighing,all_items
addition inminmax_weights
function).Checklist
format
in the repository rootpytest
in the repository root