Beruflich Dokumente
Kultur Dokumente
Linear function
When the function is linear (without any power
function, logarithmic function, inverse function or
trigonometric function)
ax + by + cz + dw = e (a, b, c, d, e = real valued; x, y,
z, w = variables)
Linear programming
All of the Objective function and Constraints are linear
combination of variables
Non-linear programming
At least one of the objective function or constraints will
be non-linear
Dipankar Bose - XLRI
Simplex LP
Linear problem
Variable can be real, binary or integer
For binary or integer variable
Branch-and-bound technique is used
GRG (Generalized Reduced Gradient) Nonlinear
Used for non-linear problem
Concept based on derivative
Generates local optimal solution
Evolutionary
Used for non-linear problem
Compares across the ranges of variables
Dipankar Bose - XLRI
Maximize:
Subject to:
z = x + 5y
x + 3y <= 10
x + y <= 6
x y <= 2
Sign constraints: x, y >= 0
The constraints can be presented as equality constraints:
Subject to:
x + 3y + S1 = 10
x + y + S2 = 6
x y + S3 = 2
S1, S2 and S3 are also variables as they depend on the
values of x and y Total variables = 5
Lets open Excel file on graph
Dipankar Bose - XLRI
x + 3y + S1 = 10
x + y + S2 = 6
x y + S3 = 2
List of variables:
x, y, S1, S2, S3
Note: All variables must be at left side of equations
The objective function:
z x 5y 0S1 0S2 0S3 = 0
Objective function coefficient vector
[ 1 5 0 0 0]
Co-efficient Matrix
Constraint co-efficient vector
1 3 1 0 0
1
1 0 1 0
Identity Matrix
1 1 0 0 1
Right hand side vector:
[10 6 2]
Reduced cost of
Basic Variables
Objective function row
BV
S1
S2
S3
Soln.
S1
10
S2
S3
BV
S1
S2
S3
Soln.
S1
10
S2
S3
Current solution:
[x y S1 S2 S3] = [0 0 10 6 2] at (x, y) = (0, 0)
Objective function value:
sumproduct([ 1 5 0 0 0] ,[0 0 10 6 2]) = 0
This is not optimal solution
All the values in z-row must be >= 0 (non-negative)
Objective function improves maximum
If we remove maximum negative co-efficient from the
objective (z-row)
Dipankar Bose - XLRI
Simplex Continued:
BV
S1
S2
S3
Soln.
Ratio
S1
10
10/3
S2
6/1
S3
NA
BV
S1
S2
S3
Soln.
S1
10
S2
S3
Z
y
S1
0
1/3
3/3
S2
S3
1/3
After Row
Operation
S2
S3
0/3
0/3
Soln.
10/3
BV
S1
S2
S3
Soln.
S1
10
S2
S3
S1
0 + 5/3
1/3
0 1/3
0 + 1/3
S2
0
0
1
0
S3
0
0
0
1
Soln.
0 + 50/3
10/3
6 10/3
2 + 10/3
S1
5/3
1/3
1/3
1/3
S2
0
0
1
0
S3
0
0
0
1
Soln.
50/3
10/3
8/3
16/3
BV
Z
y
S2
S3
x
y
1 5/3 5 + 5
1
1/3
1 + 1/3
11
1 1/3 1 + 1
Finally:
BV
Z
y
S2
S3
x
8/3
1/3
4/3
2/3
y
0
1
0
0
x
0
0
1
0
y
0
1
0
0
S1
S2
1/4
3/4
S3
0
0
0
1
Soln.
Finally
BV
Z
y
x
S3
x
8/3 + 8/3
1/3 + 1/3
1
2/3 2/3
y
0
1
0
0
S1
S2
0+2
5/3 2/3
1/3 1/12 0 + 1/4
3/4
1/4
1/3 + 1/6 0 1/2
S3
0
0
0
1
Soln.
50/3 + 16/3
10/3 + 2/3
2
16/3 4/3
x
0
0
1
0
y
0
1
0
0
S1
1
1/4
1/4
1/2
S2
2
1/4
3/4
1/2
S3
0
0
0
1
Soln.
22
4
2
4
Must be function of
Variable cells
x + 3y 10
x+y 6
xy 2
x
0
0
1
0
y
0
1
0
0
S1
1
1/4
1/4
1/2
S2
2
1/4
3/4
1/2
S3
0
0
0
1
Soln.
22
4
2
4
Variable Cells
Cell
Name
Variable 1
x
Variable 2
y
Constraints
Constraint
Cell
LHS
Constraint 1 x + 3y
Constraint 2
x+y
Constraint 3
xy
Final
Value
2
4
Reduced
Cost
0
0
Objective
Coefficient
1
5
Allowable
Increase
4
1E+30
Allowable
Decrease
2.666666667
4
Final
Value
10
6
-2
Shadow
Price
1
2
0
Constraint
R.H. Side
10
6
2
Allowable
Allowable
Increase
Decrease
8
8
8
2.666666667
Dipankar
Bose
- XLRI
1E+30
4
x + 5y
x + 3y
x+y
xy
<= 10
<= 6
<= 2
library(lpSolveAPI)
lptest = make.lp(0, 2)
lp.control(lptest, sense="max")
solve(lptest)
R1
R1
R2
R2
R2
R3
R3
R3
R4
R4
R4
C1
C2
C3
C1
C2
C3
C1
C2
C3
C1
C2
C3
R1
R1
R2
R2
R2
R3
R3
R3
R4
R4
R4
C1
C2
C3
C1
C2
C3
C1
C2
C3
C1
C2
C3
Introduction to Non-linearity
Convergence
Maximum percentage difference in
objective values in last five iterations
Derivatives
Central differencing yields more accurate
derivatives compared to forward
differentiating
Requires twice as many calculations of
the worksheet at each new trial solution
1 0 0 1 0 1 1 1 1 0
0 1 0 1 0 0 0 1 1 0
0 1 0 1 0 0 0 0 0 1
N-point
crossover
0 1 0 1 0 1 1 0 1 1
1 0 0 1 0 0 1 0 1 0
1 0 0 1 0 0 0 1 1 0
0 1 0 1 0 1 0 1 1 1
There
Mutation
1 0 0 1 0 1 1 0 1 1
1 0 1 1 0 0 1 0 1 1
0 1 0 1 0 0 0 1 1 1
0 1 0 1 0 0 0 1 0 1
Mutation rate
Selection
Example of one technique
Give random values to each member of population
Stochastic sampling with replacement
Spin the wheel n times to select n values
Corresponding members are considered
Sub-problem
A new set of population
after crossover and
mutation
Same as iteration
Convergence
Maximum allowable percentage
difference in objective values for
the top 99% of the population
Mutation Rate
The relative frequency with which
some member of the population
will be altered or mutated to
create a new trial solution
During each generation or subproblem
Typically between 1/(population
size) and 1/(chromosome length)
Dipankar Bose - XLRI
If convergence,
mutation rate or
population size is
increased Time
should be increased
Population Size
Number to maintain at any given time
in its population of candidate solutions
Solver uses a population size of 10
times the number of decision variables
in the problem, but no more than 200
Random seed
Change in random seed will change
the solution
Maximum Time without Improvement
Maximum number of seconds for
running model
Dipankar Bose - XLRI
Evolutionary outcome
Good Versus Optimal Solutions
Solver has Converged to the Current Solution
Solver Cannot Improve the Current Solution
Special cases
Unbounded solution
Multiple optimal solution
Degeneracy
Unbounded Solution
Maximize:
Subject to:
Sign constraints:
BV
Z
S1
S2
x
4
1
2
z = 4x + y
x y <= 1
2x + y <= 2
x, y >= 0
y
1
1
1
S1
0
1
0
S2
0
0
1
Soln.
0
1
2
Dipankar Bose - XLRI
x
0
1
0
y
5
1
1
S1
4
1
2
S2
0
0
1
Soln.
4
1
4
Maximize:
Subject to:
z = 4x + 10y
2x + y <= 10
2x + 5y <= 20
2x + 3y <= 18
Sign constraints: x, y >= 0
The initial simplex table:
BV
S1
S2
S3
Soln.
10
S1
10
S2
20
S3
18
S1
S2
S3
Soln.
40
S1
8/5
1/5
2/5
1/5
S3
4/5
3/5
S1
S2
S3
Soln.
40
5/8
1/8
15/4
1/4
1/4
5/2
S3
1/2
1/2
Degeneracy
Maximize:
Subject to:
Sign constraints:
z = 2x + y
4x + 3y <= 12
4x + y <= 8
4x y <= 8
x, y >= 0
BV
S1
S2
S3
Soln.
Ratio
S1
12
12/4
S2
8/4
S3
8/4
Maximize:
Subject to:
z = x + 3y
x + 2y >= 2
3x + y <= 3
x <= 4
Sign constraints: x, y >= 0
The constraints can be presented as:
Subject to:
x + 2y S1 = 2
3x + y + S2 = 3
x + 0y + S3 = 4
Co-efficient of S1 is negative
We need to penalize the function with artificial
variable R1
Dipankar Bose - XLRI
Canonical form
Conversion to Dual problem
Dual SIMPLEX method (Difference with Primal)
Comparison Final SIMPLEX table in primal and dual
Smooth functions
y = f(x) = x2
y = f(x) = - x2
Negative slope
Positive slope
y = f(x) = x3
Discontinuous function
Discontinuous function, Derivative
does not exist
Dipankar Bose - XLRI