excel solver
optimization
simulation
constraints, solver, Excel

   solver.com

Frontline Systems, Inc.  

quadratic programming, portfolio optimization, quadratic solver 
Developers of Your Spreadsheet's Solver  
robust optimization, stochastic programming, simulation optimization
   
spreadsheet solvers, optimization software

Solver Tutorial - Defining Constraints


policy constraints, physical constraints, integer constraints

 
Home
Register
What's New
Solver Tutorial
Solver Technology
Select a Product
Excel Users
Developers
MATLAB Users
Macintosh Users
Government Users
Academic Users
Press/Analysts
Privacy Policy
 

 

 
Constraints reflect real-world limits on production capacity, market demand, available funds, and so on.
  To define a constraint, you first compute a value based on the decision variables.  Then you place a limit (<=, = or >=) on this computed value.

General Constraints.  For example, if A1:A5 contains the percentage of funds to be invested in each of 5 stocks, you might use B1 to calculate =SUM(A1:A5), and then define a constraint B1 = 1 to say that the percentages allocated must sum up to 100%.

Bounds on Variables.  Of course, you can also place a limit directly on a decision variable, such as A1 <= 100.  Upper and lower bounds on the variables are efficiently handled by most optimizers and are very useful in many problems.

Policy Constraints  

Some constraints are determined by policies that you or your organization may set.  For example, in an investment portfolio optimization, you might have a limit on the maximum percentage of funds to be invested in any one stock, or one industry group.

Physical Constraints  

Many constraints are determined by the physical nature of the problem.  For example, if your decision variables measure the number of products of different types that you plan to manufacture, producing a negative number of products would make no sense.  This type of non-negativity constraint is very common.  Although it may be obvious to you, constraints such as A1 >= 0 must be stated explicitly, because the solver has no other way to know that negative values are disallowed.

As another example of a physically determined constraint, suppose you are modeling product shipments in and out of a warehouse over time.  You'll probably need a balance constraint, which specifies that, in each time period, the beginning inventory plus the products received minus the products shipped out equals the ending inventory -- and hence the beginning inventory for the next period.

Integer Constraints

Advanced optimization software also allows you to specify constraints that require decision variables to assume only integer (whole number) values at the solution.  If you are scheduling a fleet of trucks, for example, a solution that called for a fraction of a truck to travel a certain route would not be useful.  Integer constraints normally can be applied only to decision variables, not to quantities calculated from them.

A particularly useful type of integer constraint specifies that a variable must have an integer value with a lower bound of 0, and upper bound of 1.  This forces the variable to be either 0 or 1 -- nothing in between -- at the final solution.  Hence, it can be used to model "yes/no" decisions.

For example, you might use a 0-1 or binary integer variable to represent a decision on whether to lease a new machine.  Your model might then calculate a fixed lease cost per month, but also a lower cost per item processed with the machine, if it is used.  A solver can help determine whether leasing the machine will yield higher or lower profits.

Next: Interpreting Solutions

Back to How Do I Define a Model?

Back to Tutorial Start

To Learn More:
For instant access to example models, full-text User Guides, and to download free 15-day trial versions of our software products whenever you're ready, you can register now.
User Type
Email Address
Name First Last
Company University
Phone

Trial version passwords are sent to the above email address: See Privacy Policy.
Our Premium Solver Platform works with existing Excel Solver models, solves much larger problems up to hundreds of times faster, and solves new kinds of problems via Evolutionary Solver.  Solver Engines plug into the Premium Solver Platform.
   
Solver Platform SDK makes it easy to solve any type or size of optimization problem in your Visual Basic, VB.NET, C/C++, C#, Java, or MATLAB program. And it's easy to deploy your application with our flexible licensing for software vendors and corporate developers.
  balance constraints   non-negativity, nonnegativity
spreadsheet solver
scarce resources