Blogs - Tags - optimality urn:lsid:ibm.com:blogs:entries03012015-05-15T16:43:55-04:00IBM Connections - Blogsurn:lsid:ibm.com:blogs:entry-376b094a-dad9-47fa-b5e8-e7cdbd671550What Is The Gap?JeanFrancoisPuget2700028FGPactivefalseComment EntriesLikestrue2012-08-28T11:00:45-04:002012-08-29T02:42:44-04:00
<div>
My <a href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/jfp/entry/it_is_too_slow17?lang=en">last blog entry</a> triggered a discussion on twitter, where one said customers should not wait hours to get their problem solved. This made me think and I decided not to answer directly. Why? Because such discussion is meaningless until we agree on what "solving" means. <br /></div><div> </div><div>Let's go back to the basics. Excuse me if I sound pedantic, but I had to go through the same explanation when I learned about mathematical programming (MP). Indeed, my background was in constraint programming (nobody is perfect) and learning MP was kind of difficult because of language issues. As a matter of fact, after going through this learning curve I wrote a paper with Irv Lustig about it: <a href="it.ly/LjMFdW">Program Does Not Equal Program: Constraint Programming and Its Relationship to Mathematical Programming</a> in case you want to learn more about it.<br /><br />So, ready for a crash course? You can skip it if you are a MP person. You can read it if you come from another area. <br /><br /><blockquote>[start pedantic = true]<br /><br />For the sake of discussion, we assume we are dealing with a minimization problem (the other case being a maximization problem). A minimization problem is defined by two items, a set P, and a real valued function f. Solving the minimization problem amounts to find x in P such that for every y in P, f(x) <= f(y). In practice, P is a subset of R^n (elements of P are vectors of n real values), and P is defined by constraints (linear, quadratic, logic, integer, etc) on the vectors of R^n. <div> </div><div>So, solving an optimization problem amounts to meet two conditions:<br /><ol><li>Find x in P</li><li>Such that for all y in P, f(x) <= f(y)<br /></li></ol></div><div>In such case we say that x is a <i>solution</i> to the problem. If x only meets condition 1 then x is called a <i>feasible solution</i>.<br /><br />Depending on P and f, condition 2 can be much harder than condition 1. We call it <i>proving optimality</i>. Today's technology is efficient enough to solve many useful optimization problems.<br /><br />However, for some other problems proving optimality is so difficult that is cannot be done in a reasonable time using today's technology. You may have found x in P, but you don't have the time to prove condition 2. What can you do? Well, if you find a lower bound on all possible values of the objective function, i.e. a number L such that <br /><ul><li>for all y in P, L <= f(y)</li></ul>then you can evaluate how good is your x. You compute the gap as follow:</div><div><ul><li> gap = (f(x) - L)/ f(x)</li></ul></div><div> If gap = 0, then you know that condition 2 above is true, hence your x is the solution you are looking for. If the gap is non zero, then you know you may get a better x by working longer on your problem. You also know that if there is a better x it cannot be better by more than the gap. Hence, the smaller the gap, the better. Note that gap may be computed slightly differently in practice, if only to deal with the case where f(x) = 0. But the two properties stay:</div><div> </div><div><ul><li>If the gap is zero then you have solved the problem, i.e. both condition 1 and 2 above are true. </li><li>If the gap is larger than 0, the smaller the gap the better x is<br /></li></ul></div><div> The good news here is that MP technology is quite good at computing lower bounds, be it by using a relaxation of the problem, or by branch and bound. Hence MP is often quite good at providing a gap whenever x in P is found.<br /></div><div> [end pedantic = true]<br /></div></blockquote></div><div> </div><div>MP is a prominent optimization technology, but not the only one. Researchers in other areas (graph theory, artificial intelligence, physics, biology) have developed other techniques known as constraint programming, local search, meta heuristics, evolutionary algorithms, you name it. In general these techniques can meet condition 1 above, but not condition 2. They can find x in P such that f(x) is low, but they usually do not provide a gap. It is usually impossible to know how far we might be from the solution of the problem. This is true even for those techniques that can prove optimality, eg constraint programming.<br /></div><div> </div><div>Is this a problem? Is it a problem for business users? Do they care about the gap? The first time I was exposed to this definition of a gap, I though that these MP guys (CPLEX team to name them) were off track here. As far as I knew, what mattered was to find x in P wih f(x) as low as possible, but nobody cared about the proof of optimality. I now know I was wrong.<br /></div><div> </div><div>In fact it was a chicken and egg story. If you don't have a technology that provides gaps, you don't get customers interested in getting a gap. This is what happened to me. It is as simple as that.</div><div> </div><div>Now that I have been exposed to CPLEX customers for quite a while, I can testify that there are customers who require a gap, or who require optimality proof. This can be for regulatory or even legal reason. It can also be for the sake of the gap itself, i.e. for being able to evaluate how far we are from the solution of the problem. Anyway, there is a demand for good gap out there. For instance, I am currently working for a customer that requires a gap of less than 10% within two hours.</div><div> </div><div>Granted, not all customers are interested in a gap. Some just want a good feasible solution, and they don't care about optimality. It is my experience though that most customers are interested in optimality. They resist attempts at trading optimality for computation time even if it could be a sensible approach to their problem.<br /></div><div> </div><div>So, next time one speaks about solving an optimization problem, check if it is about finding a <i>feasible solution</i>, or if it is about <i>proving optimality</i> of a solution.<br /></div><div> </div><div> <br /></div><div> </div><div> </div>
My last blog entry triggered a discussion on twitter, where one said customers should not wait hours to get their problem solved. This made me think and I decided not to answer directly. Why? Because such discussion is meaningless until we agree on what...026278