I've always been writing software to solve business problems. I came across about LIP while I was going through one of the SO posts. I googled it but I am unable to relate how I can use it to solve business problems. Appreciate if some one can help me understand in layman terms.

- 55,877
- 15
- 127
- 148

- 78,777
- 46
- 231
- 327
-
I assume you're looking for something more than an intro econ example, but with integers? – Thomas Sep 30 '11 at 05:57
-
@Thomas what is intro econ example? – Aravind Yarram Sep 30 '11 at 05:59
-
2Not intro I guess, but the first serious microeconomics / price theory course. Like http://en.wikipedia.org/wiki/Linear_programming#Example, but imagine manufacturing products that must be integers, like cows and pigs instead of barley and wheat. Hopefully some creative person is going to write an awesome example as an answer. – Thomas Sep 30 '11 at 06:09
6 Answers
First, read a linear programming example from Wikipedia
Now imagine the farmer producing pigs and chickens, or a factory producing toasters and vacuums - now the outputs (and possibly constraints) are integers, so those pretty graphs are going to go all crookedly step-wise. That's a business application that is easily represented as a linear programming problem.
I've used integer linear programming before to determine how to tile n identically proportioned images to maximize screen space used to display these images, and the formalism can represent covering problems like scheduling, but business applications of integer linear programming seem like the more natural applications of it.
SO user flolo says: Use cases where I often met it: In digital circuit design you have objects to be placed/mapped onto certain parts of a chip (FPGA-Placing) - this can be done with ILP. Also in HW-SW codesign there often arise the partition problem: Which part of a program should still run on a CPU and which part should be accelerated on hardware. This can be also solved via ILP.

- 6,515
- 1
- 31
- 47
ILP can be used to solve essentially any problem involving making a bunch of decisions, each of which only has several possible outcomes, all known ahead of time, and in which the overall "quality" of any combination of choices can be described using a function that doesn't depend on "interactions" between choices. To see how it works, it's easiest to restrict further to variables that can only be 0 or 1 (the smallest useful range of integers). Now:
- Each decision requiring a yes/no answer becomes a variable
- The objective function should describe the thing we want to maximise (or minimise) as a weighted combination of these variables
- You need to find a way to express each constraint (combination of choices that cannot be made at the same time) using one or more linear equality or inequality constraints
Example
For example, suppose you have 3 workers, Anne, Bill and Carl, and 3 jobs, Dusting, Typing and Packing. All of the people can do all of the jobs, but they each have different efficiency/ability levels at each job, so we want to find the best task for each of them to do to maximise overall efficiency. We want each person to perform exactly 1 job.
Variables
One way to set this problem up is with 9 variables, one for each combination of worker and job. The variable x_ad will get the value 1 if Anne should Dust in the optimal solution, and 0 otherwise; x_bp will get the value 1 if Bill should Pack in the optimal solution, and 0 otherwise; and so on.
Objective Function
The next thing to do is to formulate an objective function that we want to maximise or minimise. Suppose that based on Anne, Bill and Carl's most recent performance evaluations, we have a table of 9 numbers telling us how many minutes it takes each of them to perform each of the 3 jobs. In this case it makes sense to take the sum of all 9 variables, each multiplied by the time needed for that particular worker to perform that particular job, and to look to minimise this sum -- that is, to minimise the total time taken to get all the work done.
Constraints
The final step is to give constraints that enforce that (a) everyone does exactly 1 job and (b) every job is done by exactly 1 person. (Note that actually these steps can be done in any order.)
To make sure that Anne does exactly 1 job, we can add the constraint that x_ad + x_at + x_ap = 1. Similar constraints can be added for Bill and Carl.
To make sure that exactly 1 person Dusts, we can add the constraint that x_ad + x_bd + x_cd = 1. Similar constraints can be added for Typing and Packing.
Altogether there are 6 constraints. You can now supply this 9-variable, 6-constraint problem to an ILP solver and it will spit back out the values for the variables in one of the optimal solutions -- exactly 3 of them will be 1 and the rest will be 0. The 3 that are 1 tell you which people should be doing which job!
ILP is General
As it happens, this particular problem has a special structure that allows it to be solved more efficiently using a different algorithm. The advantage of using ILP is that variations on the problem can be easily incorporated: for example if there were actually 4 people and only 3 jobs, then we would need to relax the constraints so that each person does at most 1 job, instead of exactly 1 job. This can be expressed simply by changing the equals sign in each of the 1st 3 constraints into a less-than-or-equals sign.

- 50,331
- 10
- 105
- 169
-
1The assignment problem is not really a good ILP example since a normal LP solver will find the optimal integer solution just fine. It is one of my favourite LP examples though. – hugomg Sep 30 '11 at 13:59
-
@missingno: You're right, but I think you need general ILP if you want to complicate the problem, e.g. if you had 4 people but only 3 jobs. With just LP here, if two people had the same efficiencies at each job, then any linear combination of them summing to 1 could be used to do a job! :) – j_random_hacker Oct 01 '11 at 04:57
A sample ILP problem will looks something like:
- maximize 37∙x1 + 45∙x2
where
- x1,x2,... should be positive integers
...but, there is a set of constrains in the form
- a1∙x1+b1∙x2 < k1
- a2∙x1+b2∙x2 < k2
- a3∙x1+b3∙x2 < k3
- ...
Now, a simpler articulation of Wikipedia's example:
- A farmer has L m² land to be planted with either wheat or barley or a combination of the two.
- The farmer has F grams of fertilizer, and P grams of insecticide.
- Every m² of wheat requires F1 grams of fertilizer, and P1 grams of insecticide
- Every m² of barley requires F2 grams of fertilizer, and P2 grams of insecticide
Now,
- Let a1 denote the selling price of wheat per 1 m²
- Let a2 denote the selling price of barley per 1 m²
- Let x1 denote the area of land to be planted with wheat
- Let x2 denote the area of land to be planted with barley
- x1,x2 are positive integers (Assume we can plant in 1 m² resolution)
So,
- the profit is a1∙x1 + a2∙x2 - we want to maximize it
- Because the farmer has a limited area of land: x1+x2<=L
- Because the farmer has a limited amount of fertilizer: F1∙x1+F2∙x2 < F
- Because the farmer has a limited amount of insecticide: P1∙x1+P2∙x2 < P
a1,a2,L,F1,F2,F,P1,P2,P - are all constants (in our example: positive)
We are looking for positive integers x1,x2 that will maximize the expression stated, given the constrains stated.
Hope it's clear...

- 19,919
- 6
- 53
- 85
-
Not a great example I'm afraid. ILP doesn't require the coefficients (a1, a2, L, F1, F2, F, P1, P2, P) to be integer, only the variables x1 and x2. In your example, x1 and x2 represent areas of land, which is something that is naturally divisible, so it seems artificial to require them to be integers -- you would do just fine solving this with ordinary "real" (i.e. not integer) LP, which is much faster. – j_random_hacker Sep 30 '11 at 11:43
ILP "by itself" can directly model lots of stuff. If you search for LP examples you will probably find lots of famous textbook cases, such as the diet problem
Given a set of pills, each with a vitamin content and a daily vitamin quota, find the cheapest cocktail that matches the quota.
Many such problems naturally have instances that require varialbe to be integers (perhaps you can't split pills in half)
The really interesting stuff though is that actually a big deal of combinatorial problems reduce to LP. One of my favourites is the assignment problem
Given a set of N workers, N tasks and an N by N matirx describing how much each worker charges for the each task, determine what task to give to each worker in order to minimize cost.
Most solution that naturally come up have exponential complexity but there is a polynomial solution using linear programming.
When it comes to ILP, ILP has the added benefit/difficulty of being NP-complete. This means that it can be used to model a very wide range of problems (boolean satisfiability is also very popular in this regard). Since there are many good and optimized ILP solvers out there it is often viable to translate an NP-complete problem into ILP instead of devising a custom algorithm of your own.

- 68,213
- 24
- 160
- 246
The other answers here have excellent examples. Two of the gold standards in business of using integer programming and more generally operations research are
- the journal Interfaces published by INFORMS (The Institute for Operations Research and the Management Sciences)
- winners of the the Franz Edelman Award for Achievement in Operations Research and the Management Sciences
Interfaces publishes research that uses operations research applied to real-world problems, and the Edelman award is a highly competitive award for business use of operations research techniques.

- 2,641
- 2
- 26
- 33
You can apply linear program easily everywhere you want to optimize and the target function is linear. You can make schedules (I mean big, like train companies, who need to optimize the utilization of the vehicles and tracks), productions (optimize win), almost everything. Sometimes it is tricky to formulate your problem as IP and/or sometimes you meet the problem that your solution is, that you have to produce e.g. 0.345 cars for optimum win. That is of course not possible, and so you constraint even more: Your variable for the number of cars must be integer. Even when it now sounds simpler (because you have infinite less choices for your variable), its actually harder. In this moment it gets NP-hard. Which actually means you can solve ANY problem from your computer with ILP, you just have to transform it.
For you I would recommend an intro into reading some basic (I)LP stuff. From my mind I dont know any good online site (but if you goolge you will find some), as book I can recommend Linear Programming from Chvatal. It has very good examples, and describes also real use cases.

- 15,148
- 4
- 32
- 57
-
Downvote: there a few issues with this answer. I would suggest using objective function instead of target function, which is the standard name. It's true that the objective function must be linear. The constraints must also be linear. It's also not strictly true that you can solve "any problem on your computer" with integer programming. – user327301 Mar 19 '13 at 17:27
-
With "objective" you are right, that is the correct term (I am german, and the used term there is "Zielfunktion", which can be translated into both objective and target function). The ANY of refers only to computable problems (it can neither solve the world hunger problem nor the halting problem), and as you can transform (almost) all problems to an ILP instance, you can solve them (as long as you have a computer which is fast enough to solve an NP-hard problem of the given size). – flolo Mar 20 '13 at 09:23