Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is easy to solve (a few lines of code) as an integer program. Using a tool like the <a href="http://www.gnu.org/software/glpk/" rel="nofollow noreferrer">GNU Linear Programming Kit</a>, you specify your constraints in a declarative manner and let the solver come up with the best solution. <a href="http://www.ibm.com/developerworks/linux/library/l-glpk1/#N101FE" rel="nofollow noreferrer">Here</a>'s an example of a GLPK program.</p> <p>You could code this using a general-purpose programming language like Python, but this is the type of thing you'll see in the first few chapters of an integer programming textbook. The most efficient algorithms have already been worked out by others.</p> <p>EDIT: to answer Merjit's question:</p> <p>Define:</p> <ol> <li>matrix Y where Y_(ij) = 1 if tape i is played before tape j, and 0 otherwise. </li> <li>vector C, where C_i indicates the time slot when i is played (e.g. 1,2,3,4,5,6,7) </li> <li>Large constant M (look up the term for "big M" in an optimization textbook)</li> </ol> <p>Minimize the sum of the vector C subject to the following constraints:</p> <pre><code>Y_(ij) != Y_(ji) // If i is before j, then j must not be before i C_j &lt; C_k + M*Y_(kj) // the time slot of j is greater than the time slot of k only if Y_(kj) = 1 C_O - C_L = 1 // L must be played immediately before O C_N &gt; C_L // news tape must be played at some time after L |C_G - C_P| = 2 // You will need to manipulate this a bit to make it a linear constraint </code></pre> <p>That should get you most of the way there. You want to write up the above constraints in the MathProg language's syntax (as shown in the links), and make sure I haven't left out any constraints. Then run the GLPK solver on the constraints and see what it comes up with.</p>
    singulars
    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. VO
      singulars
      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