Skip to content

Non-optimality? #104

Description

@WaterGenie35

Example

  • Boots with all 4 protection types (p, bp, pp, fp), depth strider (ds), feather falling (ff), mending (m), soul speed (ss), thorns (t), unbreaking (u), and 2 curses (cb, cv)

Using the tool, this gives:

135 levels, 4 anvil use on the final boot for least prior work penalty
133 levels, 5 anvil use on the final boot for least xp

But this combination where I tried to optimise for least prior work penalty gives 130 levels, 4 anvil use:

boot ss  t   ff  bp  pp  fp   u  ds   p  cb   m    cv
  \  /    \  /    \  /    \  /    \  /    \  /     /
   12       4       4       3       4       2     /
      \   /           \   /           \   /      /
        18              9               8       /
           \          /                   \    /
	        25                           7
	            \                     /
			        34

I haven't worked with cases where the anvil use is not optimal yet so I don't know about least xp.
I also don't have any proof yet so I also don't know if this example is the optimum for least penalty.

Construction This particular example is obtained by first determining the height/optimal anvil use, constructing a tree that is most left-heavy under the given height, then distributing enchantments from most to least expensive over leaf nodes with least to most number of right branches leading up to it.

I defined leaf-heaviness as the number of leaf nodes in pre-order traversal, but it was very awkward so there should be a different formulation that's easier to work with/automate T-T

The number of right branches corresponds to how many times the enchanting cost of each leaf contributes to the final cost. For this tree, we get:

0  1  1  2  1  2  2  3  1  2  2  3   2
 \/    \/    \/    \/    \/    \/   /
   \  /        \  /        \  /    /
      \        /             \    /
            \                 /

So the 4 most expensive (ss, t, bp, ds costing 12, 12, 8, and 6 respectively) goes to the leaves in the 1-group, next most expensive in the 2-group, and so on.

From the readme, the search should be exhaustive, so it should at least run into the 130-cost example, so maybe there's an inadmissible heuristic somewhere in the search?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions