S3-SA3-0464
What is an Optimisation Algorithm in ML?
Grade Level:
Class 9
AI/ML, Data Science, Physics, Economics, Cryptography, Computer Science, Engineering
Definition
What is it?
An Optimisation Algorithm in Machine Learning is like a smart search strategy that helps a computer program find the best possible solution to a problem. It works by trying different options and learning from each try to get closer and closer to the ideal outcome, like finding the lowest error or highest accuracy.
Simple Example
Quick Example
Imagine you want to score maximum marks in your Maths exam. You try different study methods – sometimes you read notes, sometimes you solve problems, sometimes you watch videos. An optimisation algorithm is like your brain figuring out which study method (or combination) gives you the best marks by trying them out and improving.
Worked Example
Step-by-Step
Let's say a delivery app wants to find the shortest route for a delivery executive to drop off three parcels (A, B, C) starting from the warehouse (W).
Step 1: List all possible routes.
Route 1: W -> A -> B -> C
Route 2: W -> A -> C -> B
Route 3: W -> B -> A -> C
Route 4: W -> B -> C -> A
Route 5: W -> C -> A -> B
Route 6: W -> C -> B -> A
---Step 2: Assign a 'cost' (distance in km) to each segment of the route.
WA = 5km, WB = 7km, WC = 4km
AB = 3km, AC = 6km
BA = 3km, BC = 2km
CA = 6km, CB = 2km
---Step 3: Calculate the total distance for each route.
Route 1: 5 + 3 + 2 = 10km
Route 2: 5 + 6 + 2 = 13km
Route 3: 7 + 3 + 6 = 16km
Route 4: 7 + 2 + 6 = 15km
Route 5: 4 + 6 + 3 = 13km
Route 6: 4 + 2 + 3 = 9km
---Step 4: Compare all total distances and find the minimum.
Minimum distance = 9km
---Step 5: Identify the route corresponding to the minimum distance.
This is Route 6: W -> C -> B -> A.
Answer: The shortest route is W -> C -> B -> A, with a total distance of 9km. This process of finding the best route is what an optimisation algorithm does, but for much more complex problems.
Why It Matters
Optimisation algorithms are super important because they help computers make the best decisions quickly. They are used by engineers to design faster cars, by economists to predict market trends, and by scientists to develop new medicines. Learning about them can open doors to exciting careers in AI and data science.
Common Mistakes
MISTAKE: Thinking an optimisation algorithm always finds the *perfect* best solution every single time. | CORRECTION: For very complex problems, it often finds a *very good* solution, which is close to the best, rather than the absolute perfect one, especially when time or computing power is limited.
MISTAKE: Believing optimisation algorithms are only used in Machine Learning. | CORRECTION: While crucial in ML, these algorithms are widely used in many fields like logistics (delivery routes), finance (investment strategies), and even game development, not just ML.
MISTAKE: Confusing an optimisation algorithm with the 'output' of a machine learning model. | CORRECTION: An optimisation algorithm is a *tool* used *during* the training of an ML model to improve its performance, it's not the final prediction or classification itself.
Practice Questions
Try It Yourself
QUESTION: A farmer wants to maximise his crop yield. He can use two types of fertiliser, A and B. He finds that 1kg of A gives 10kg of crop, and 1kg of B gives 12kg of crop. He has 10kg of fertiliser in total and must use at least 3kg of each. What combination of A and B should he use to maximise yield? | ANSWER: He should use 3kg of A and 7kg of B. Yield = (3 * 10) + (7 * 12) = 30 + 84 = 114kg.
QUESTION: A school wants to arrange students in a line for an assembly to minimise the total height difference between adjacent students. If the heights are 140cm, 150cm, 145cm, 155cm, what is the minimum total height difference if they are arranged in ascending order? | ANSWER: The order would be 140, 145, 150, 155. Total difference = (145-140) + (150-145) + (155-150) = 5 + 5 + 5 = 15cm.
QUESTION: A tiffin service needs to deliver 4 orders (P, Q, R, S) from their kitchen (K). The distances (in km) are: KP=2, KQ=3, KR=4, KS=5. Also, PQ=1, PR=3, PS=4, QR=2, QS=3, RS=1. Find the shortest route that visits all 4 orders and returns to the kitchen. (Hint: Try a few common-sense routes first). | ANSWER: One possible short route is K -> P -> Q -> R -> S -> K. Total distance = 2 + 1 + 2 + 1 + 5 = 11km. (Other routes might be K->P->Q->S->R->K = 2+1+3+1+4 = 11km. The problem is complex and often needs advanced algorithms, but for this small example, 11km is a good minimum found by inspection).
MCQ
Quick Quiz
Which of the following best describes the goal of an optimisation algorithm?
To make a computer program faster
To find the best possible solution or outcome for a given problem
To store large amounts of data efficiently
To display information in a user-friendly way
The Correct Answer Is:
B
Optimisation algorithms are designed to search for and identify the most favourable solution, such as the lowest cost, highest profit, or smallest error. Options A, C, and D describe other aspects of computing but not the core purpose of optimisation.
Real World Connection
In the Real World
When you use Google Maps or any ride-hailing app like Ola or Uber, an optimisation algorithm is working behind the scenes. It calculates the fastest route from your current location to your destination, considering live traffic, road closures, and even one-way streets, to ensure you reach your destination in the minimum possible time.
Key Vocabulary
Key Terms
OPTIMISATION: The process of making something as good or effective as possible. | ALGORITHM: A step-by-step set of instructions to solve a problem. | MACHINE LEARNING: Teaching computers to learn from data without being explicitly programmed. | PARAMETER: A setting or value that can be changed to influence the outcome of a process. | COST FUNCTION: A mathematical function that measures how 'bad' a solution is (lower is better).
What's Next
What to Learn Next
Next, you can explore specific types of optimisation algorithms like Gradient Descent, which is widely used in Machine Learning. Understanding these types will show you how the 'smart search' actually happens step-by-step in real ML models, building on what you've learned here.


