Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My first inclination to is try branch-and-bound. You can do it breadth-first or depth-first, and I prefer depth-first because I think it's cleaner.</p> <p>To express it simply, you have a tree-walk procedure <code>walk</code> that can enumerate all possibilities (maybe it just has a 5-level nested loop). It is augmented with two things:</p> <ul> <li><p>At every step of the way, it keeps track of the <code>cost</code> at that point, where the cost can only increase. (If the cost can also decrease, it becomes more like a minimax game tree search.)</p></li> <li><p>The procedure has an argument <code>budget</code>, and it does not search any branches where the cost can exceed the budget.</p></li> </ul> <p>Then you have an outer loop:</p> <pre><code>for (budget = 0; budget &lt; ... ; budget++){ walk(budget); // if walk finds a solution within the budget, halt } </code></pre> <p>The amount of time it takes is exponential in the budget, so easier cases will take less time. The fact that you are re-doing the search doesn't matter much because each level of the budget takes as much or more time than all the previous levels combined.</p> <p>Combine this with some sort of heuristic about the order in which you consider branches, and it may give you a workable solution for typical problems you give it.</p> <p>IF that doesn't work, you can fall back on basic heuristic programming. That is, do some cases by hand, and pay attention to how you did it. Then program it the same way.</p> <p>I hope that helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload