Using Modern Tools for Operations Research: Concepts & Codes

Abigail Rose Lindner
Abigail Lindner
Regent University
Egbe-Etu Etu
Wayne State University
Evrim Dalkiran, Ph.D.
Wayne State University

Operations research (OR) has been an academic and industry focus that has gained prominence since World War II, being used to optimize, predict and solve challenging problems across many sectors. To help introduce new OR students to the implementation of key optimization techniques, this article reviews several main optimization concepts, as well as implementations in Python and R.

Linear Programming

Linear Programming (LP) is both a fundamental and commonplace form of optimization: many, many problems may be expressed as linear programs (see Figure 1). For example, resource allocation problems and many others from business supply-chain applications may be modeled as LPs. We briefly introduce the basics of an LP problem as well as several repositories that may be helpful for implementing a LP:

  1. A set of variables,
    x = [x1, ..., xn]T, x ∈ Rn

  2. A linear objective function to minimize or maximize
    f(x) = cTx, c ∈ Rn

  3. A set of linear constraints of the form
    aTx ≥ b or aTx ≤ b or aTx = b
    where a ∈ Rn and b ∈ R

LP Overview

Figure 1: Graphical overview of LP (Source: Stojiljkovic, (2020))

Integer Programming
Integer Programming (IP) operates similarly to LP in that it seeks to optimize a function involving various variables with certain constraints, with the additional restriction that variables assume integer values (see Figure 2). Thus the restriction on variable values determines whether IP or LP should be employed: variables with discrete values (e.g., age) can be assessed via IP; and variables with continuous values (e.g., medicine dosages) can be assessed via LP.
A common problem in IP is set covering. Set covering involves a finite set U and a collection of subsets of U : S1, S2, ..., Sn. As an example, facility location problems employ the idea of set covering.
The goal is to identify the fewest number of subsets such that their union is U. Integer programming is employed to solve a set covering problem by considering a binary variable xi for each subset Si, where xi = 1 when Si is selected for inclusion in the union and xi = 0 otherwise (Trevisan, 2011). A solution is obtained thusly:

Equation 1

The objective function minimizes the number of subsets comprising the union, while the constraint specifies that each element of U must appear in at least one of the subsets Si.
Another simple problem that may be solved via IP is the knapsack problem. Consider a knapsack with maximum weight constraint W. Then consider n types of items with corresponding values v1, v2, ..., vn and weights w1, w2, ..., wn. The goal is to pack the knapsack such that the value of the packed items is maximized while respecting the weight capacity of the knapsack. In the 0-1 IP version of this problem, either one item of a given type may be taken or no items of a given type may be taken. A general knapsack problem allows the "packer" to take more than one item for a given type. For delivery companies, the issue of cargo loading is a knapsack problem.
Given time and perseverance, a student could calculate the solutions for simple examples of either of these problem types but solving by hand becomes unwieldy as the number of variables increases. The links below provide implementations for both the set covering and knapsack problems.

IP Solution

Figure 2: Solution for IP problem (Source: Eudoxus Systems Ltd.)

Mixed-Integer Programming
Mixed-integer programming (MIP) involves problems where some of the decision variables are constrained to be integers (e.g., 0, 1, 2), while other variables take continuous values. Although solution techniques for MIPs have existed for many years, recent advances in computing power, algorithms, and data availability have made it possible to model and solve the world's most complex business problems as increasingly tractable MIPs. A basic mathematical representation of MIP is given as follows:

  1. A linear objective function to minimize or maximize
    z = cTx

  2. A set of linear constraints of the form
    Ax ≤ b, x ≥ 0 and integer
    where x = [x1, ..., xn]T is the decision variable vector (i.e., the unknowns)
    c = [c1, ..., cn]T is the objective function coefficient vector
    b = [b1, ..., bm]T are the constraint bounds (i.e., the right-hand side)

Branch and Bound Method
Branch and bound, often abbreviated BB or B&B, is an algorithm that seeks an optimal solution to a variety of mathematical optimization problems (see Figure 3). The technique improves upon the idea of a complete enumeration, wherein each possible solution of the decision variables is considered and represented in an enumeration tree. For a problem with n variables, a tree that completely enumerates all solutions will have 2n leaves. For multivariate problems, complete enumeration quickly becomes unwieldy. Rather than fully exploring solutions, B&B uses a routine called pruning to eliminate the vast majority of solutions quickly and effectively.
To begin, B&B relaxes any integrality constraints for the variables in order to solve for the LP relaxation of the problem, using typical LP techniques. The result provides bounds for subsequent steps. The first node of our branch and bound diagram for a maximization problem, LP(1), will contain the upper bound solution zLP*(1), with variable values zLP*(1), found through the LP relaxation and possibly a lower bound solution zIP*(1) found by a search algorithm, such as rounding down/up each variable value from the LP solution. Whereas zLP*(1) is a relaxed solution, zIP*(1) is a feasible solution to the problem. The optimal integer solution exists between these bounds.
Upon completing the bounding step, the branching process continues: one variable is identified (e.g., having the largest fractional part in xLP*(1)) as the branching variable and two child nodes are created. Suppose the variable xk is selected, having the value xk* in xLP*(1). Two child nodes from node 1 are then created, each with an additional constraint: xk ≥ ceiling(xk*) in one; and xm ≤ floor(xk*) in the other. The resultant LP relaxations for nodes 2 and 3 are solved and zLP*(2) and zLP*(3) are obtained, along with possibly integer solutions zIP*(2) and zIP*(3) through a search algorithm. When new integer solutions, xIP*(2) and xIP*(3), are found, we update the incumbent solution and lower bound LB = max {zIP*(1), zIP*(2), zIP*(3)}. The nodes that have already been explored (branched on), or provide an integer solution to the LP relaxation, or for which zLP* ≤ LB are all fathomed, or pruned from the search tree. As new node problems are solved, we update the upper bound, i.e., UB = max {zLP*(k), k is unfathomed}. Once the bounds are updated, the branching step continues. The process ends when all unfathomed nodes have been explored.


Figure 3: Tree-like structure for BB problem

Transportation Problems
To discuss transportation problems, we must first consider network-flow problems, as the former are a special case of the latter.
Consider an industrial good produced at various plants and desired at various markets. Each plant has a given capacity and each market has a given need. Transportation from plant to market - from origin to destination - may also pass through intermediate points, rather than going directly from the plant to market. The origins, destinations, and intermediate points may be viewed as nodes in a network. The goal of a network-flow problem is to minimize the cost of production and shipment while satisfying the demands of each destination.
The transportation problem removes the intermediate locations. It may be formulated as follows (Bradley, Hax, and Magnanti, 1977):

Equation 2

The objective minimizes the total cost of transportation for all units, while the constraints ensure that the supply capacity at each origin is respected and the demand at each location is satisfied. This basic formulation assumes that supply meets demand, though this is not always the case.

Decision Analysis
Decision analysis is a formalized method for selecting optimal choices that have uncertain outcomes. This outcome uncertainty can be characterized by probability distributions for variables that represent the key consequences of the considered actions (Howard, 1988). The decision maker's relative preference for the various possible outcomes can then be described by a utility function that also captures the decision maker's attitude toward risk. A logical decision maker thus prefers the action that maximizes a particular mathematical combination of the derived probabilities and utilities. Figure 4 is a graphical illustration of a decision tree.
Multiple-criteria decision analysis (MCDA) is a sub-discipline of operations research that explicitly evaluates multiple conflicting criteria in decision making. Conflicting criteria are typical in evaluating options: cost or price is usually one of the main criteria, and some measure of quality is typically another criterion.

Decision Tree

Figure 4: Decision Tree Analysis (Source: Prachi M. (2019))



  1. Bradley, S., Hax, A., and Magnanti, T. (1977). “8 Network Models.” Applied Mathematical Programming. Addison-Wesley Publishing Company.  
  2. Cornuéjols, G., Trick, M. Saltzman, M. (1995). A tutorial on integer programming. Clemson University,
  3. Howard, R. A. (1988). Decision analysis: practice and promise. Management science, 34(6), 679-695.
  4. Trevisan, Luca. (2011). Lecture 8 [PDF]. Stanford University CS261.

Image Sources:

  1. Eudoxus Systems Ltd. (n.d.). How to make integer programming go faster. Eudoxus Systems Ltd.,
  2. User: Prachi M. (2019). Decision tree analysis. The Investors Book,
  3. Shokry, S., Tanaka, S., Nakamura, F. Ariyoshi, R. (2018). Bandwidth maximization approach for displaced left-turn crossovers coordination under heterogeneous traffic conditions. Journal of Traffic and Transportation Engineering, 6, 183-196.
  4. Stojiljkovic, Mirko. (2020). Hands-on linear programming: Optimization with Python. Real Python,