Finance

Charts

Statistics

Macros

Search

What Is Discrete Programming with Excel VBA

Discrete programming studies extremum problems in which the decision variables are subject to discreteness and the feasible set is finite. These are primarily problems where many factors and objects are physically indivisible. Discrete programming also includes a range of integer programming problems in which the decision variables take only integer values (e.g., staffing/scheduling) or logical, Boolean values 0 or 1 (e.g., the assignment problem). Below we consider the solution of an assignment problem.

Each instructor can teach certain types of classes. The hourly pay cij for instructor ii on class type is given in Table. Construct a teaching plan so that all class types are covered, each instructor teaches only one class type, and the total hourly cost is minimized.

Table. Hourly costs

Instructors \ Courses 1 2 3 4
1 350 420 610 200
2 890 130 650 900
3 430 520 600 720
4 830 610 780 470

Steps to Solve

Check balance

The problem is balanced because the number of instructors equals the number of class types. If unbalanced, introduce the missing number of dummy instructors (rows) or dummy class types (columns).

Constructing the mathematical model of the problem.
Let xij=1 if the i-th teacher performs the j-th type of class, and xij=0 otherwise.
Then the mathematical model is: minimize the functional

subject to the constraints:

Solve with the Solver add-in

Prepare the worksheet as in Fig.

The calculation formulas are shown in Table.

Table. Worksheet formulas for the assignment problem

Description Cell Formula
Constraints G11 =SUM(C11:F11)
G12 =SUM(C12:F12)
G13 =SUM(C13:F13)
G14 =SUM(C14:F14)
Constraints C15 =SUM(C11:C14)
D15 =SUM(D11:D14)
E15 =SUM(E11:E14)
F15 =SUM(F11:F14)
Quality functional (work cost) G17 =SUMPRODUCT(C5:F8; C11:F14)

In the Solver Parameters window :

  • Set Objective: the total cost cell.
  • To: Min.
  • By Changing Variable Cells: the assignment matrix xij.
  • Subject to the Constraints:
    • Row sums =1=1 (each instructor once).
    • Column sums =1=1 (each class once).
    • Binary on all xijcells.
  • In Options, ensure appropriate precision; enable Assume Linear Model if using Simplex with binary constraints (still requires Binary flag).

The resulting optimal assignment is shown:

0 0 votes
Évaluation de l'article
S’abonner
Notification pour
guest
0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
Online comments
Show all comments
Facebook
Twitter
LinkedIn
WhatsApp
Email
Print
0
We’d love to hear your thoughts — please leave a commentx