views:

371

answers:

6

I read over the wikipedia article, but it seems to be beyond my comprehension. It says it's for optimization, but how is it different than any other method for optimizing things?

An answer that introduces me to linear programming so I can begin diving into some less beginner-accessible material would be most helpful.

+5  A: 

http://www.tutornext.com/linear-programing/3055

Kenoyer130
+1, that's a good link.
FrustratedWithFormsDesigner
A: 

One big difference (or at least, distinguishing feature) of linear programming is that the constraints are modeled as linear equations, i.e. they're all of the form c_1 x_1 + c_2 x_2.... The standard form section of the wikipedia article gives a pretty good overview of this.

Another difference/feature is that linear programming is seeking to maximize (or minimize) ONE function - you can't effectively do multi-objective optimization.

awshepard
Isn't maximization of one function the norm?
Mathias
@Mathias - perhaps it's the norm, but it's not the only type of optimization that exists.
awshepard
@awshepard: actually, I would be interested in hearing about what you have in mind! An optimization problem is mathematically the minimization of some function, and because you can't minimize 2 functions of the same variable together, typically you end up minimizing a single function of these functions (like a weighted combination of them...).
Mathias
@Mathias - wikipedia refers to the "simplest case" of optimization being minimization/maximization of one function, and then links out to the multi-objective optimization page. Perhaps what's confusing me/our discussion is that a professor of mine once referred to the knapsack problem as a multi-objective optimization problem (minimize weight, maximize value); in retrospect, it's really just maximize value subject to the constraint that the knapsack only hold a certain amount.
awshepard
@Mathias (cont'd) - The multi-objective optimization page also refers to the aggregation-of-functions approach, though mentions that it's subjective in terms of the choice of weights...Clearly I need to do some more reading to brush up on this stuff... :).
awshepard
+5  A: 

Linear programming is a topic of 'mathematical programming', which is also called 'mathematical optimization'. Linear programs differ from general mathematical programs in that for a Linear Program (LP) all constraint functions and the objective function are linear with respect to their variables.

A good place to start would be here if you want the original work by Dantzig, or if you want to get a textbook, I recommend this one. If you want to look up your own resources, start with looking up the Simplex method--it is a very common technique to solve these programs, or the less common but definitely polynomial time Ellipsoid method. Though I haven't read it all, looking it over quickly also suggests this PDF may be a good place to start. Make sure whatever you end up reading covers duality (and perhaps specifically the Farkas' lemma) as it's a central idea in most LP solvers.

The most natural extensions are either Integer programs (similar to LP's, but all variables must take on integer values--that is, no fractional components) or Convex programming (perhaps a more general extension). A good convex optimization text book is available in PDF form here.

Jan Gorzny
+1  A: 

Linear programming is an optimization technique that involves linear constraints and a linear objective function. The constraints are written to bound the problem space, while the objective function is something that you are attempting to minimize (or possibly maximize) that satisfies the constraints. The simplex algorithm is typically used to walk along edges of the constraint intersection to find the minimum (or maximum) value of the objective function satisfying the constraints.

When setting up an LP problem, it's important to make sure that the constraints properly bound the objective function. It's possible to define constraints which result in no possible solution (e.g. x > 1 and -x > 1). This is over constrained. It's also possible to under-constrain a problem (e.g. find min x such that x < 1).

andand
I'm sure this is pointless to ask given that the question is now closed, but would the person who modded me down be kind enough to explain why? Thanks.
andand
A: 

As everyone else has said, Linear Programming is a way to solve optimization problems, in which the terms are linear.

It might help to understand what types of problems LP's solve

One example where I've used Linear Programming is building a restaurant schedule. In a restaurant you have skill sets:

  • Cooks
  • Servers
  • Dishwashers
  • Hosts
  • Bussers
  • Manager etc

And you have employees, each with one or more skill sets. Each employee also has a specific availability. For example, Bob can't work Sunday mornings because he's a pastor at a local church. Employees also have an associated cost. Bob might be $10.50/hr while Suzy is $5.15/hr. Finally Employees might have minimum guaranteed hours. Since Bob has been an employee for 15 years, the boss says he'll always get at least 35 hours.

The restaurant itself has demands. For example it has 3 shifts: Morning, Afternoon, and Night, and each of these shifts has a set of staffing requirements: We need 1 cook, 1 server, 1 manager in the morning, 3 cooks, 2 servers, 2 hosts, 2 managers in the afternoon, and 4 cooks, 4 servers, 3 hosts, 2 managers, 2 bussers in the evening. Each shift will have a duration, and you can figure out the cost of each shift by multiplying the duration by the employee's hourly wage.

Finally we have state and federal laws, and some basic "business" rules: No employee can work more than 8-hours without going into overtime. No employee can be scheduled for less than 2 hours (because it would suck to make a 30 minute commute for a 2 hour shift), employees can't work two overlapping shifts, etc.

Now given all these requirements, give me a schedule that has meets all requirements, and produces the lowest labor cost.

This is an example of a linear programming optimization problem.

A linear program typically consists of:

An objective function, variables, variable bounds, and constraints.

Since we want to minimize cost, our objective function is going to involve shifts that employees work, and the associated costs (shift duration * wage).

The variables in this case, are the shifts that each employee can work.

The bounds on these variables integers between 0 and 1, because either an employee is working the shift (1), or the employee is not working the shift (0). This, by the way, is a special program, called a Binary Integer Program or BIP for short, because all the variables are integers (no fractional values) and all values are either 0 or 1.

The constraints are equality/inequality constraints based on the requirements above.

For example, if Bob and Suzy can both work as cooks in the morning, then Bob_Morning_Cook1_Shift + Suzy_Morning_Cook1_Shift = 1, with Bob_Morning_Cook_Shift = {0,1} and Suzy_Morning_Cook_Shift = {0,1} due to the bounds mentioned above. These three pieces of information specify that at most only a single employee can be assigned as the first morning cook.

So once you've defined all the constraints that model your problem, you can begin to solve the problem. If a solution can be found (and depending on the constraints the problem may be infeasible), it will give you the employee assignments that produce the lowest weekly labor cost.

Alan
+4  A: 

The answers so far have given an algebraic definition of linear programming, and an operational definition. But there is also a geometric definition. A polytope is an n-dimensional generalization of a polygon (in two dimensions) or a polyhedron (in three dimensions). A convex polytope is a polytope which is also a convex set. By definition, linear programming is an optimization problem in which you want to maximize or minimize a linear function on a convex polytope.

For example: Suppose that you want to buy some combination of red sand and blue sand. Suppose also:

  1. You can't buy a negative amount of either kind.
  2. The depot only has 300 pounds of red sand and 400 pounds of blue sand.
  3. Also your jeep has a weight limit of 500 pounds.

If you draw a picture in the plane of how much you can buy with these constraints, it's a convex pentagon. Then, whatever you want to optimize (say, the total amount of gold in the sand), you can know that an optimum (not necessarily the only optimum) is at one of the vertices of the polytope. In fact, there is a much stronger result: Even in high dimensions, any such linear programming problem can be solved in polynomial time, in the number of constraints, or putative sides of the polytope. Note that not every constraint corresponds to a side. If the constraint is an equality, it might reduce the dimension of the polytope. Or if the constraint is an inequality, it might be not create a side if it is already implied by all of the other constraints.

There are a lot of practical optimization problems that are linear programming. One of the first examples was the "diet problem": Given a menu of a bunch of kinds of food, what is the cheapest possible balanced diet? It's a linear programming problem because the cost is linear, and because all of the constraints (vitamins, calories, the assumption that you can't buy a negative amount of food, etc.) are linear.

But, linear programming is even more important for a theoretical reason. It is one of the most powerful polynomial-time algorithms for optimization or for any other purpose. As such, it is very important as a substitute for approximately solving other optimization problems, and as a subroutine for exactly solving them.

Yes, two generalizations are convex programming and integer programming. With some qualificiations, convex programming can work just as well as linear programming, provided that the objective (the thing to maximize) is linear. It turns out that convexity, not flat sides, is the main reason that linear programming has a good algorithm.

Integer programming, on the other hand, is usually hard. For instance, suppose in the example problem you have to buy the sand in fixed-size bags rather than in bulk; that is then integer programming. There is a theorem that it can be NP-hard. How hard it is in practice depends on how close it is to linear programming. There are some celebrated examples of integer programming problems in which, miraculously, all of the vertices of the linear program are integer points. Then you can solve the linear program and the solution will happen to be integral. One example of such a problem is the marriage problem, how to marry n men and n women to each other to maximize total happiness. (Or, n cities to n factories, n jobs to n applicants, n computers to n printers, etc.)

Greg Kuperberg