0% found this document useful (0 votes)
4 views

Linear Programming Method

Uploaded by

Mohd Amir
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Linear Programming Method

Uploaded by

Mohd Amir
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

FACULTY OF MECHANICAL ENGINEERING AND

MANUFACTURING

DATA OPTIMIZATION AND MACHINE LEARNING – BDS 45403

Semester 1 Session 2024/2025

ASSIGNMENT 1
APPLICATION OF LINEAR PROGRAMMING SIMPLEX METHOD

LECTURER’S NAME: PROF. MADYA TS. DR. SYARIFUL SYAFIQ BIN


SHAMSUDIN

NO. NAME MATRICS NUMBER


1. MUHAMAD AMIR BIN ABDUL SAMAD AD180248
1. Program Title:
Maximizing Airline Profits by Flight Scheduling Using Linear Programming Simplex Method
2. Introduction to the Program Code:
Linear programming (LP) is a mathematical technique used to optimize a particular objective function
subject to a set of linear constraints. It's widely used in various fields including aviation industry to
solve problems such as airline crew scheduling, aircraft routing and scheduling, revenue management,
fuel management and etc.
Using LabVIEW for Linear Programming
1. Understanding the Problem
Before implementing an LP model in LabVIEW, clearly define:
• The objective function (maximize or minimize).
• The decision variables (the unknowns to solve for).
• The constraints (the limitations that restrict the values of the decision variables).

2. Setting Up LabVIEW Environment


• Install LabVIEW: Ensure LabVIEW is installed on computer.
• Open LabVIEW: Start a new VI (Virtual Instrument) for the project.

3. Building the LP Model


1. Define Inputs:
• Create controls for decision variables.
• Use numeric controls for coefficients in the objective function and constraints.
2. Constructing the Objective Function:
• Use a formula node or mathematical functions to define objective function based on the
input variables.
3. Defining Constraints:
• Use comparison functions to implement constraints in the code.

4. Using Libraries for Optimization


While LabVIEW does not have built-in LP solvers, external libraries or toolkits can be utilize:
• MathScript: LabVIEW's MathScript RT Module to call MATLAB functions.
6. Displaying Results
a. Output Results: Once the solver returns the optimal values, use indicators in LabVIEW
to display:
• Optimal decision variables.
• Optimal value of the objective function.
3. Programming Code Development:

I. Open up Labview and create new VI. Save the VI as Linear Programming Program.
II. Right-click on the block diagram and navigate to Mathematics / Optimization and drag
Linear Programming Simplex Method.vi onto the block diagram.

III. Right-Click on the Linear Programming Simplex Method.vi C input to create Control
IV. Then Right-Click on M input and create Control.

V. After that, Right-Click on the Linear Programming Simplex Method.vi B input and create
Control.

VI. Right-Click on the Linear Programming Simplex Method.vi Maximum Output and create
Indicator.
VII. Then Right-Click on the Linear Programming Simplex Method.vi X Output and create
Indicator.

VIII. After that, Right-Click on the block diagram and navigate to Dialog & User Interface and
drag Simplex error handler.vi onto the block diagram.
IX. Right-click on the Simple Error Handler.vi Input of type of dialog and create constant.

X. Set the constant to continue/stop + warnings


XI. Right-click on the Simplex Error Handler.vi message output and create indicator.

XII. Wire the Linear Programming Simplex Method.vi error output to Simplex Error
handler.vi error code input.

XIII. Right-click on the block diagram and navigate to structures and drag Case Structure onto
the block diagram.
XIV. Right-click on the block diagram and navigate to Numerics and drag Ring constant onto
the Block Diagram.

XV. Right-Click on the Ring Constant and change it to control. Then select the properties and
on the edit items, put in the value of maximize and minimize.
XVI. The value of minimize set to 0 and maximize to 1.

XVII. Change the Ring Constant name to Optimization Problem and wire it into Case Structure
Input.
XVIII. Rewire C Vector into Case Structure with default selector and back onto Linear
Programming Simplex Method.vi C Input.
XIX. Change case structure selector to 1. Right-click on the block diagram and navigate to
numeric and drag negate inside the case structure.

XX. Connect the wiring from C vector to negate input and output to Linear Programming
Simplex Method.vi C input.
XXI. Change the output of Linear Programming Simplex Method.vi Maximum 2 to Optimum
and X2 to Solution.

XXII. Right-click on the block diagram and navigate to structure and click While Loop. All the
component must be inside the While Loop. Right-click on the loop condition input and
create control.
XXIII. Right-click on the block diagram and navigate to Timing and drag waut (ms) onto the
block diagram.

XXIV. Right-click on the wait (ms) input and create constant of 100.
4. Simulation with Application to relevant Machine Learning Problem:
Linear Programming Problem in the Aviation Industry
Problem Context: An airline seeks to optimize its flight scheduling to maximize profit while adhering
to various operational constraints. This Airline has more than four constraints focusing on the
allocation of aircraft across multiple routes.
Problem Statement
Objective: Maximize the total profit from scheduled flights.
Decision Variables
• Let x1 = number of flights on Route A
• Let x2 = number of flights on Route B
• Let x3 = number of flights on Route C
• Let x4 = number of flights on Route D
Profit per Flight
• Route A: $500
• Route B: $700
• Route C: $600
• Route D: $800
Objective Function
Maximize profit:
Z=500x1+700x2+600x3+800x4
Constraints
1. Total Aircraft Availability: The airline has a maximum of 25 aircraft available.
x1+x2+x3+x4≤25x
2. Crew Availability: Each flight requires a crew, with a total of 30 crews available.
x1+x2+x3+x4≤30x
3. Flight Time Limitations: The airline can only operate a maximum of 60 flight hours per week.
2x1+3x2+1.5x3+2.5x4≤60
(Route A takes 2 hours per flight, Route B takes 3 hours, Route C takes 1.5 hours, and Route D takes
2.5 hours)
4. Minimum Flights Requirement: There must be at least 4 flights on Route A and at least 3 on
Route B.
x1≥4x, x2≥3x
5. Maximum Flights on Route C: The airline has decided not to operate more than 10 flights on
Route C.
x3≤10
6. Budget Constraints: The total operational cost for flights cannot exceed $20,000, where costs
per flight are as follows:
• Route A: $300
• Route B: $400
• Route C: $350
• Route D: $450
300x1+400x2+350x3+450x4≤20000
7. Non-negativity Constraints:
x1, x2, x3, x4≥0
LP Model Setup
Objective Function: Maximize
Z=500x1+700x2+600x3+800x4
Subject to:
1. Total aircraft availability:
x1+x2+x3+x4≤25
2. Crew availability:
x1+x2+x3+x4≤30
3. Flight time limitations:
2x1+3x2+1.5x3+2.5x4≤60
4. Minimum flights on Route A:
x1≥4x
5. Minimum flights on Route B:
x2≥3x
6. Maximum flights on Route C:
x3≤10
7. Budget constraints:
300x1+400x2+350x3+450x4≤20000
8. Non-negativity:
x1, x2, x3, x4≥0
Solution:

Standard Form of Linear Programming:


1. Maximization Problem
2. Equalities on constrains
3. Non-negative Variable
From standard form of Linear Programming, we must change the inequalities constraints to equality
constraints as below:

1. Total aircraft availability:


-x1-x2-x3-x4 = -25
2. Crew availability:
-x1-x2-x3-x4 = -30
3. Flight time limitations:
-2x1-3x2-1.5x3-2.5x4 = -60
4. Minimum flights on Route A:
x1 = 4
5. Minimum flights on Route B:
x2 = 3
6. Maximum flights on Route C:
-x3 = -10
7. Budget constraints:
-300x1-400x2-350x3-450x4 = 20000
8. Non-negativity:
x1, x2, x3, x4≥0

Key in data of Objective function and Data constrains onto front panel as below:

From the data we obtain the solution as below:


• Number of flights on Route A = 4
• Number of flights on Route B = 3
• Number of flights on Route C = 2
• Number of flights on Route D = 16
Thus, yielding maximum Profit of $18,100.00
5. Observation:
In addressing the optimization of flight schedules for an airline, a linear programming model was
formulated with the objective of maximizing profit while adhering to various constraints related to
aircraft availability, crew limits, flight time limitations, minimum flight requirement, maximum flight
requirement and budget constraints. The decision variables included the number of flights allocated to
Routes A, B, C, and D.
The optimal solution revealed that scheduling 4 flights on Route A, 3 on Route B, 2 on Route C and
16 on Route D would yield the highest profit, effectively utilizing the available resources within the
established limitations. This outcome not only enhances operational efficiency but also ensures that the
airline maximizes its revenue potential in a competitive market.
However, the model operates under certain assumptions, such as static demand and fixed operational
costs. Future iterations could benefit from incorporating dynamic factors, such as fluctuating fuel prices
or seasonal demand variations, to further refine the optimization process. Overall, this analysis
underscores the critical role of linear programming in facilitating informed decision-making within the
aviation sector, ultimately contributing to improved profitability and service delivery

6. Results and Discusion:


The linear programming model developed to optimize flight scheduling yielded an optimal solution
that allocates 4 flights to Route A, 3 flights to Route B, 2 flights to Route C, and 16 flights to Route D.
This allocation maximizes the airline’s profit to $18,100 while satisfying all operational constraints,
including a total aircraft limit of 25, crew availability of 30, flight time limitations of 60, minimum and
maximum flights and a maximum budget of $20,000. The solution is feasible under the specified
conditions and demonstrates robustness.
7. Summary / Conclusion:
In conclusion, the application of linear programming effectively optimized the airline's flight schedule,
highlighting its potential to enhance operational efficiency and maximize profits. The findings indicate
that strategic resource allocation can significantly impact an airline's competitiveness in the market.
However, the study is limited by assumptions of constant demand and fixed costs, which may not
accurately reflect the complexities of real-world operations. Future research should consider
integrating dynamic market factors to refine these optimization models further. Ultimately, this study
reinforces the critical role of mathematical modeling in driving informed decision-making within the
aviation industry, contributing to sustainable and profitable operations.

You might also like