Lab 8 Ip, DP, Ga: Integer Programming
Lab 8 Ip, DP, Ga: Integer Programming
Lab 8 Ip, DP, Ga: Integer Programming
Ryerson University
Integer Programming
Capital Budgeting Example - ABC manufacturing Co. (example of binary variables)
ABC manufacturing Co is considering in setting up 4 production lines with following net present
value (NPV) payoff and upfront cash investment. It cannot setup eg. three line 1, only one can
be setup for each line. ABC has $14,000 is available cash at present. Formulate an IP whose
solution will tell ABC which lines it should set up to maximize NPV.
NPV
Upfront cash
line 1
16,000
5,000
line 2
22,000
7,000
line 3
12,000
4,000
line 4
8,000
3,000
(c) If ABC invests in line2, they cannot invest in line 4 and vice versa
Ryerson University
Dynamic Programming
Characteristics of Dynamic Programming Applications
Characteristic 1
The problem can be divided into stages with a decision required at each stage.
Characteristic 2
By a state, we mean the information that is needed at any stage to make an optimal
decision.
Characteristic 3
If the states for the problem have been classified into on of T stages, there must be a
recursion that relates the cost or reward earned during stages t, t+1, ., T to the cost or
reward earned from stages t+1, t+2, . T.
Companies need to determine how long a machine should be utilized before trade in for a
new one.
Ryerson University
GENETIC ALGORITHM
The problem here is
Max Z = 2x1 + 3x2 - x12 - x22
S.T.
x 1 + x2 2
x1, x2 0
CODE
clc;
close all
clear all;
%Defining function
lb = zeros(2,1);
A = [1 1]; % Constraint
b = 2; % RHS of constraint
z = @(x) (-2*x(1) - 3*x(2) + x(1)^2 + x(2)^2); % Obj Function
[x, fval] = ga(z,2, A, b, [],[], lb)