Is there an obvious limit on the size of the denominator in the best solution for a particular pair? Then at least you could brute force small cases to ensure you have the best answer.
Indeed, but I haven't yet found such a limit, or even a proof of rationality!As I was saying to someone in another forum:One would like to think that there's some nice proof involving local perturbations – pick the smallest fragment size and adjust it by ε, then adjust some other fragment of the same stick by −ε to make up for it, which means in turn that a fragment of the appropriate stick at the other end of the dissection goes by +ε, and ... you hope to end up with a closed loop of adjustments, or several such loops superimposed, and hence an adjustment to your original dissection which is legal for some sufficiently small ε > 0 and increases the length of every currently minimal fragment. If you can do that, then the dissection you started with was not a local optimum, and hence not a global optimum either.The point of doing this would be that it gives you a reason why the smallest fragment keeps turning out to be achieved by cutting a single stick into equal pieces – because then clearly no such perturbation can increase the length of all those pieces at once, or else the result wouldn't fit in that stick any more.But I don't actually have a proof along those lines, only a sketch of the sort of thing I'd like the proof to achieve. And even that wouldn't prove that an optimum dissection had to have all fragments rational, only that the smallest fragment had to be rational.In fact I'd guess it's quite likely that optimal dissections need not have the longer fragments all rational (there's probably some situation in which you can find a closed loop of those local perturbations that never touch a minimal fragment, in which case you can apply that change with irrational ε to get a partially irrational and equally good answer), but I'd at least hope that there exists a rational optimal dissection in every case...
there's probably some situation in which you can find a closed loop of those local perturbations that never touch a minimal fragment, in which case you can apply that change with irrational ε to get a partially irrational and equally good answerIn fact, yes, the 7/5 example in my original post admits just such a transformation. Where we previously dissected three 7-sticks as (8/3 + 8/3 + 5/3) and the other two as (7/3 + 7/3 + 7/3), we now do:
Because you have to match up the + and - irrationals I don't think you get a longer smallest stick doing this; although obviously you can have the same-length smallest stick.I've written a thing that looks for integer solutions; but it's slow and crap and obviously "I searched exhaustively and found this" is much less interesting than "I thought really hard about it and realised that all solutions look like this". Also it can't handle irrationals and so far can do fractions only where all stick-fragments share a denominator....
Indeed, you certainly can't get a longer smallest stick by small perturbations of that answer, because one of the 5-sticks is entirely made up of smallest-fragments and so if you lengthen them all by any ε > 0 then that stick overflows. What I was hoping to show was that the converse is also true – that the only way in which a dissection can be locally optimal is if some stick is made up entirely of smallest-fragments, by showing that in all other cases you can find a system of ε-adjustments that lengthens every smallest-fragment. No luck yet, though!(In fact, writinghawk has proved over on LJ that my dissection for 5-into-7 is globally as well as locally optimal, which is more than I had previously known.)I've written a thing that looks for integer solutionsOoh, I'd like to see whatever data it's generated.Also it can't handle irrationals and so far can do fractions only where all stick-fragments share a denominatorIn any rational dissection there must be some denominator shared by all fragments (just take the lcm of all denominators), so the latter isn't a problem. And I'm still convinced that irrationals can't appear in any solution unless there's an equally good or better one without them (I have a half-thought-out proof idea involving treating R as a vector space over Q), so I'm not worried about the former either.
So far it is tediously slow and hasn't got anything harder than 5,7...
Apparently I'm not exactly doing this the optimal way... because 7 x 10 in 1/3 steps is, er, ENOMEMORY. Fantastic.5 x 8 sticks in half integer steps is best with 4 sticks cut into 2/3 and 4 uncut assembled into 4 lots of 3/5 and 1 of 2/2/2/2 which gives more than 3 stick-parts.With m and n <= 10 and m<n in half integer steps 12 combinations have a smallest-stick-fragment larger than gcd(m,n); 4 of which are non-integer (5 x7 is the smallest).
I have no idea how to prove whether any given answer could be bested by taking smaller steps other than by trying progressively smaller steps and seeing.
5 x 8 sticks in half integer steps is best with 4 sticks cut into 2/3 and 4 uncut assembled into 4 lots of 3/5 and 1 of 2/2/2/2 which gives more than 3 stick-parts.Borrowing writinghawk's proof technique: in a better solution, each of the five 8-sticks would have to be cut into at most three pieces (if you cut one in four then a piece must be <=2), which gives 15 pieces overall, and so at least one of the eight 5-sticks must end up as a single piece (15 isn't enough pieces for two each). The 8-stick including that whole 5-stick then has 3 units of length left over; if you divide that in two then you have a piece <=1.5 (no good) and OTOH if you leave it whole then that leaves 2 units on the 5-stick you cut it off.So this dissection for 5 into 8 cannot be beaten even if you were to increase the denominator, and hence gerald_duck's question is indeed answered.(I do wonder how far that proof technique can be automated. It might give rise to a better search algorithm!)
Hm. My guess would have been that the best dissection is rational, but isn't always equal sized. But I've not tried it at all, just read what you wrote here.
Aha, now I think I've got a proof of rationality. Suppose we have some dissection containing an irrational fragment. We will show it isn't optimal (under my extended criterion that if two dissections' shortest fragment lengths are equal then you tie-break by looking at the second shortest distinct length and so on).Choose a basis B for R as a vector space over Q, and choose it so that it includes an actual rational q. Write every fragment length in the dissection as its unique weighted sum of elements of B. Rational lengths will therefore be represented as straightforward multiples of q.The shortest irrational fragment length, being irrational, must have a nonzero coefficient for at least one element of B that isn't q; let b be such an element. Look at the coefficients of b across all fragments of the dissection. They must sum to zero in every input and output stick (because those sticks' lengths are all rational, hence have zero coefficient of everything other than q). So if we pick any real ε and adjust every fragment length by ε times its coefficient of b, we must get a system of adjustments that preserves every input and output stick length, and which always adjusts equally long sticks by the same amount. So in particular we can choose ε so that it has the correct sign to slightly increase the shortest irrational length (and has absolute value small enough not to make any two lengths cross over each other), and then applying those adjustments yields a strictly better solution.Hence, no dissection with any irrational fragment can be optimal (under the extended criterion including tie-breaking), and in particular no dissection with an irrational shortest fragment can be optimal even under the original criterion. (Slightly icky because it uses the Axiom of Choice, almost certainly unnecessarily. But AC is obviously true, right? So no problem really. :-)
I now actually read this proof, and it sounds right to me, though I don't guarantee I haven't missed some exception.What confused me in the pub is, you use the axiom of choice to get a basis for R over Q. But don't you just need a basis over Q for the vector space generated by the fragment lengths you actually have, not over any possible irrationals? Isn't that just some subset of the fragment lengths, throwing away any non-linearly-independent ones?
Ah! Yes, good thought. And that vector space is finite-dimensional, because we have at most finitely many frag lengths, and hence we don't need AC to conclude that it has a basis. Well done.
Ian has written a fairly shiny search program which confirms your guess that the best dissection is not always equal-sized. 7 into 4 has minimum fragment 5/3, which is not an integer fraction of either stick length. So much for my conjecture.(I leave the exact dissection of 7 into 4 as an exercise, but it shouldn't be hard given the minimum length :-)
Ah! Very cool. I'm glad someone wrote a search program :)I'm flattered you call my comment a conjecture, when it was only really saying I wasn't convinced by your conjecture. But I'm glad we found an answer deciding it :)Stupid question, if the search program finds a best answer, how does it show that's the best? Is there an obvious limit on something? Previously we seemed to have no way of clearly showing an answer _is_ the best, except by special-case proofs like writing-hawk's.
Stupid question, if the search program finds a best answer, how does it show that's the best?Not a stupid question at all, since nobody else had thought of an answer to that problem!Ian's basic idea is to start by (WLOG) assuming each input stick contributes at most one piece to each output stick (clearly if that's not true then you can merge fragments until it is without making your score worse). So now you have an n × m matrix of fragment lengths. Next, we want to treat the problem as a linear-programming optimisation exercise, trying to maximise one variable ("smallest nonzero matrix entry") under a collection of linear constraints (matrix entries all positive, rows and columns sum to the right thing). The trouble with that is that it's not actually a linear problem, since the objective criterion is nonlinear (taking min of all the matrix entries isn't a linear function). But if you knew the adjacency matrix (that is, you knew which input sticks contribute at all to which output sticks) it would be, because you could introduce the minimum frag length itself as an extra variable, so that some matrix elements were constrained to zero and others were of the form (min_frag + some positive extra value). So Ian simply iterates over all possible adjacency matrices and appeals to a linear-programming library to solve that optimisation problem for each one, and once he's gone through all possible matrices then he knows he's considered every answer!Of course, then you optimise as hard as you can (by e.g. iterating over adjacency matrices in a sensible order that means you see the best ones first, stopping as soon as your matrix gets too dense because then some stick has to be cut into enough pieces that the smallest won't beat your existing best answer, parallelising over all the CPUs you can find, etc). But that's the basic idea.
Ah! Thank you. I couldn't see how the program would find it, I assumed it was obvious in some other way, but that approach makes sense even if it's brute force. It's considerable progress to be able to find optimal solutions at all.Has any pattern emerged in the results found?I wonder if it's possible to make any theoretical progress following the same approach? (But I'm just speculating I haven't even had time to start thinking about it yet.)
We're still working on getting the searcher to be both fast and accurate :-/ (I know it's missing at least one optimal solution in its current state.) When I have a large amount of data I more or less trust, I'll post it somewhere.
I know it's missing at least one optimal solution in its current state.Oops! I hope it comes into shape.
Hold on a second. Did you mean that the best dissection involved the shortest fragment being coming from an equal size division of some stick? Or that the best dissection involved SOME stick being equally divided? Because I wasn't sure there was an obvious reason for the first, but the second could still be true (if I've got the right solution for 4<->7)?Or rather, what happens if you try to increase all the shortest lengths by epsilon? That obviously fails if several of them compose a single stick. That's what you were trying to explain to me before. But if you follow through adjusting all other stick lengths epsilon as you described, it has to fail *somewhere* or you didn't start with a local optimum. Another way it could fail is if the *complements* of the shortest fragments are equal divisions of a stick. But there may be other ways as well, if you end up with a stick made of fragments that all have to get longer or all have to get shorter, but came from a different number of steps from the original perturbation.But if the optimal solution for some division is 5/3, I can't help but wonder if that means *something* has to be divided into three equal pieces.I wonder if this might be easier to imagine looking at perturbing a matrix as you described, instead of sticks.
A more specific conjecture would be that any optimal dissection (in your extended criterion of tie-breaking) of a set of n m-sized sticks and a set of m n-sized sticks into two identical piles of fragments can be performed by a sequence of "Divide (the remainder of) some stick from one set into N (N>=1) equal sized fragments, and removing the corresponding fragments from sticks in the other set. Then repeat, dividing one of the new remainders, until nothing is left."I don't think that's worded quite right, but I think something like that. If so, maybe a perturbations argument could show that if at some step you divide into the same number of fragments of slightly different lengths, you can follow through the remainder of the steps in the same way. And if so, the non-equal division would be sub-optimal (because one stick of that length gets shorter).But I'm not sure if that's actually right, or just another plausible guess that will turn out to have exceptions.
This seems like just the sort of conjecture that we could actually check against the piles of data from the search program! (Which may now be working [crosses fingers], so some data might actually be forthcoming once I've sorted out a way to present it legibly.)