OPERATIONS RESEARCH AND HIGH ENERGY PHYSICS Alberto De Min Politecnico di Milano and INFN A. De Min CHEP06 Mumbai, India 13-17 February 2006 1 INTRODUCTION Operations Research (OR) is the discipline of applying advanced analytical methods to help make better decisions Applications concern an uncountable number of fields: from economics to finance, from logistics to supply chain management, from social sciences to politics, from engineering to physics The aim of this talk is to illustrate possible applications to high energy physics and review the existing mathematical tools, restricting the scope to linear and mixed-integer programming applications A. De Min CHEP06 Mumbai, India 13-17 February 2006 2 LAYOUT Basics of operations research Two practical examples: Resource optimization, Set covering Linear programming: – Simplex method – Interior-point method Mixed-integer programming Applications to high energy physics Two pattern recognition examples: – Vertex tracking – Muon tracking Other detector issues (calibration, alignment, design, logistics) Mathematical libraries Commercial software packages Open source packages Conclusions A. De Min CHEP06 Mumbai, India 13-17 February 2006 3 EXAMPLE 1 (resource optimisation) A firm produces tables and chairs in 3 phases: cutting, assemblying and finishing. The firm wants to maximise total profit. Cutting Assemblying Finishing Profit per item Chair: time required 6/5h 1h 3/2h $80 Table: time required 1h 1/2h 2h $55 50h 120h Available manpower (h/d) 72h Objective function -> Maximize z = 80 x + 55 y subject to: Constraint 1 -> 6/5 x+ y 72 Constraint 2 -> x + ½ y 50 Constraint 3 -> 3/2 x + 2y 120 Positiveness of variables -> x,y 0 Solution: x = 35.0 chairs and y = 30.0 tables should be produced per day A. De Min CHEP06 Mumbai, India 13-17 February 2006 4 EXAMPLE 2 (set covering) An airline needs to cover its flights with crew (based in city A). 1) Build all possible flight sequences (rotations) leaving and returning to A 2) Choose the subset of rotations (j) covering all flights (i) with minimum A B B C C A cost (Cj) A BB A A C C A Objective function -> Minimize z = j Cj xj subject to: Set covering (or set partitioning) -> flight i j Rij xj 1 ( or =1) where Integrality of variables -> xj ={0,1} xj=1 (0) if rotation j is (not) selected Rij = 1 (0) if rotation j does (not) include flight i 1) Solution is a set of integer (binary) values for xj 2) xj = 0.5 cannot be approximated to 0 (no covering) or 1 (no optimum) A. De Min CHEP06 Mumbai, India 13-17 February 2006 5 LINEAR PROGRAMMING 1. Solution is a point in n-dim space 2. Linear functions are (hyper)planes in that space 3. Linear constraints () define the half-space above (below) a plane 4. The space of feasible solutions is all points inside the convex polyedrum defined by the constraint-planes (a «politope » or « simplex ») 5. The objective function is an infinity of parallel planes of which we need the uppermost intersecting the politope 6. The optimal solution is the point of such intersection A. De Min Max z = A01 x1 + A02 x2 + … subject to: A11 x1 + A12 x2 + … B1 A21 x1 + A22 x2 + … B2 A31 x1 + A32 x2 + … B3 x1, x2 0 CHEP06 Mumbai, India 13-17 February 2006 6 THE SIMPLEX METHOD 1. The optimal solution cannot be an internal point (as it would always be possible to find a « more optimal » point nearby!) 2. The optimal solution needs to be on a corner (or an edge if degenerate) 3. Only the (few) corners need to be analysed to reach optimality 4. The objective function determines the direction to a better corner 5. A complex minimization task has been reduced to an easy combinatorial problem 6. The discovery of the simplex method in 1947 gave Dantzig the Nobel Price 7. This is an « external point method » A. De Min CHEP06 Mumbai, India 13-17 February 2006 7 INTERIOR POINT METHODS 1. Take the politope of feasible solutions 2. Build an ellipsoid contained in the politope 3. Find the tangence point A with the objective plane 4. Build a new ellipsoid centered in A contained in the politope 5. Repeat until size of ellipsoid is small enough 6. Easy when matrix of coefficients is sparse (many zeros!) 7. It works also for non-linear cases 8. For some problems faster than the simplex 9. Developed in the last few decades 10.This is an « internal point method » A. De Min Objective function A CHEP06 Mumbai, India 13-17 February 2006 B 8 (MIXED) INTEGER PROGRAMMING Suppose some variables should be integer but non-integer values are found at optimum Store corresponding value of objective function (OF) as a lower bound (LB) on the solution Take one such variables, say Xi=1.3, and branch into two separate problems (nodes or trees) imposing the additional constraints Xi= 1 or Xi=2 Xi= 1.3 X= 1 i Solve the corresponding LP problem for each node: 1.If the solution is infeasible or OF is larger than UB -> prune the node 2.If in the solution all required variables are integer -> : Xi= 2 – If no upper bound (UB) exists on the solution -> store the corresponding OF as an initial upper bound (UB) – If the OF is smaller than an already existing UB -> update the upper bound – If the OF is larger than an already existing UB -> prune the node 3.If in the solution some required variables are still non-integer -> branch further the problem Continue until all required variables are integer. This method is called «branch & bound », alternative methods are: « branch & cut », « branch & price », « implicit enumeration », etc. A. De Min CHEP06 Mumbai, India 13-17 February 2006 9 HEP APPLICATIONS: EXAMPLE 1 Global VDET pattern recognition for ALEPH, P.Rensing, CHEP95 Extrapolating tracks from TPC to the silicon vertex detector (VDET), featuring two double-sided lawyers (4 readout layers), presents ambiguities in hit assignment process. How to assign VDET hits to tracks optimally? Minimize z = ijklm Cijklm xijklm, with xijklm=0,1 subject to: TPC track i jklmxijklm=1 hit j in layer 1 iklmxijklm=1,2 hit k in layer 2 ijlmxijklm=1,2 hit l in layer 3 ijkmxijklm=1,2 (1 configuration per track) (1 or 2 tracks per hit, depending on hit signal amplitude) hit m in layer 4 ijklxijklm=1,2 1 2 VDET 3 4 Cijklm = 2 + 11NNon associated + 4N1 dimension (i=0 means no assigned track; j,k,l,m=0 means no hit in VDET layer 1,2,3,4) A. De Min CHEP06 Mumbai, India 13-17 February 2006 10 HEP APPLICATIONS: EXAMPLE 2 Linear pattern recognition algorithm for the CMS barrel muon detector, A. De Min, CMS Note, Feb 2006, being submitted to CMS In CMS tracks are straight lines in a noisy environment. Linear programming can be used to remove outliers: 1. Pi =(Xi,Zi) should be associated to straight line x=mz+q if |Xi-mZi+q| i (i is the « resolution » of Pi) mZi+q-Xi i 2. This is not a linear constraint! But it can be linearized: -mZi-q+Xi i 3. Best (linear) fit is min ( / ) subject to: mZi+q-Xi i i i i -mZi-q+Xii provided that only points with i i are considered (pattern recognition) 4. Try combining pattern recognition and fit in a single problem by adding the new integer (binary) variables i = {0,1} and new constraints A. De Min CHEP06 Mumbai, India 13-17 February 2006 11 HEP APPLICATIONS: EXAMPLE 2 The problem can be formulated as follows (M is a big, fixed number): Minimize residuals -> Minimize f = i (i / i ) subject to, i: Straight line -> mZi+q-Xi i +iM -mZi-q+Xi i +iM Pattern recognition -> i - i iM i - i (1-i)M New binary variable -> i = {0,1} m,q 0 Hit Zi Xi i i i 1 1.0 1.0 0.1 0.000 0 (i=1) (i i) hit Pi out of the fit 2 1.0 2.1 0.1 0.1 1 The solution will provide a fast, unbiased pattern recognition and a stable (linear) fit in one go! It also provides the list of included points (i=0) and their residuals i 3 2.3 1.6 0.1 0.072 0 4 3.0 2.2 0.1 0.1 1 5 3.9 2.5 0.1 0.000 0 6 5.0 3.1 0.1 0.031 0 (i=0) (i i) hit Pi in the fit A. De Min CHEP06 Mumbai, India 13-17 February 2006 12 OTHER HEP APPLICATIONS Apart from pattern recognition problems, LP may be useful in several other applications related to HEP. A few examples: 1. Detector design (ex. to optimize cabling network in order to minimize the material in front of the calorimeters) 2. Detector construction (ex. optimal assembly schedule, optimal use of resources, supply chain management and spare parts procurement) 3. Detector alignment (ex. tracker subparts alignment with charged tracks) 4. Detector calibration (ex. optimal shower clustering in test-beams for calorimeter) 5. Data analysis (ex. optimal association of calorimeter showers to charged tracks) 6. Logistics in HEP laboratories (ex. shift roster of minimum cost, optimal test-beam period allocation) A. De Min CHEP06 Mumbai, India 13-17 February 2006 13 AVAILABLE LIBRARIES Two kinds of packages: Modeling systems: • Designed to help people formulate LP problems and analyze their solutions. • In practice they are modeling languages. • Output is in standard format to feed any LP solver. • Not of interest here, more dedicated to consultants who need to quickly apply LP techniques to solve very different problems. • An old but still widely used standard format is the MPS format (originally from IBM). Essentially a matrix description convention. LP solvers: • Algorithmic codes devoted to finding optimal solutions to specific linear problems. • A code takes as input a the LP numerical coefficients in standard format and produces as output a compact listing of optimal solution values. • LP solvers are available as commercial packages and as open source A. De Min CHEP06 Mumbai, India 13-17 February 2006 14 AVAILABLE LIBRARIES Most used commercial packages: – – – ILOG/CPLEX: Simplex,Interior,Integer (www.ilog.com) Xpress-MP: Simplex,Interior,Integer (www.dashoptimization.com) IBM/OSL: Simplex,Interior,Integer (www.optimize.com) In general rather sophisticated and expensive, but special agreements possible for research use. Some versions are parallelizable for GRID platforms. Best open source packages: – – – COIN-OR (COmputational INfrastructure for Operations Research): Simplex,Integer. Originally from IBM and now available under Common Public Licence (www.coin-or.org) GLPK (GNU Linear Programming Kit): Simplex,Interior,Integer. Available under the GNU General Public Licence (www.gnu.org/software/glpk/glpk.html) Lp_solve: Simplex,Integer. Available, under the GNU Lesser Public Licence (www.coinor.org) Not as performing as commercial codes, but free and available in source code. See licence for permitted uses. For additional information see also: http://www-unix.mcs.anl.gov/otc/Guide/faq/linear-programming-faq.html A. De Min CHEP06 Mumbai, India 13-17 February 2006 15 CONCLUSIONS A wide class of problems encountered in HEP can be formulated similarly to problems related to other fields of human activities, normally covered by Operations Research It is advisable that the HEP community is kept informed of the latest OR achievements for what concerns both mathematical algoritms and software packages and has quick access to all available tools Limited to (mixed-integer) linear programming, this talk has provided a brief overview of the existing tools and of their possible applications to HEP A. De Min CHEP06 Mumbai, India 13-17 February 2006 16