هل تعلم أن قرارك في اختيار أفضل طريق للgoing to work هو حل لمشكلة ت optimisation؟
كل يوم، نtake decisions. من اختيار أفضل طريق إلى work إلى تحديد كميات الفواكه التي نشتري من السوق، نحن ن optimise without knowing it. ت optimisation هي فنة take best decisions when we have multiple options and constraints. في هذا المقال، سنستكشف theory behind هذه الفنة، مع examples من الحياة daily.
Definition: ت optimisation هي process find best solution from a set of possible solutions, based on specific criteria.
foundations: المفاهيم basic
Before we dive in, let's define some key concepts.
- Objective function: هي function ن want to maximize or minimize. For example, maximizing profit or minimizing cost.
- Constraints: هي restrictions limit possible solutions. For example, budget constraints or resource limits.
- Feasible region: هي set of solutions that satisfy all constraints.
Key point: في ت optimisation، goal هو find best solution within feasible region. Without constraints, any solution is possible, but often constraints make the problem interesting and realistic.
deep dive 1: ت optimisation linear
Let's start with linear optimisation, which deals with linear objective functions and constraints. Imagine you own a small shop selling two products: apples and oranges. You want to maximize your profit, but you have constraints like limited space and budget.
Let's say:
- Profit per apple: 2 JDs
- Profit per orange: 3 JDs
- Space constraint: 100 apples + 200 oranges ≤ 1000 units
- Budget constraint: 5 JDs per apple + 4 JDs per orange ≤ 200 JDs
We can represent this as:
$$ \text{Maximize } Z = 2x + 3y $$ $$ \text{Subject to:} $$ $$ x + 2y \leq 1000 $$ $$ 5x + 4y \leq 200 $$ $$ x, y \geq 0 $$
Example: Let's say we choose x=20, y=40. Check constraints:
- Space: 20 + 80 = 100 ≤ 1000 ✔️
- Budget: 100 + 160 = 260 > 200 ❌
So this solution is not feasible.
| x | y | Profit (Z) | Feasible? |
|---|---|---|---|
| 0 | 0 | 0 | ✔️ |
| 20 | 40 | 160 | ❌ |
| 20 | 30 | 130 | ✔️ |
| 40 | 20 | 140 | ✔️ |
deep dive 2: ت optimisation quadratic
Now, let's look at quadratic optimisation, where the objective function is quadratic. Imagine you want to minimize the cost of producing two products, where the cost depends on the square of the quantities.
For example: $$ \text{Minimize } C = x^2 + 2y^2 $$ $$ \text{Subject to:} $$ $$ x + y \geq 10 $$ $$ x, y \geq 0 $$
In this case, the cost function is a paraboloid, and the minimum is at the vertex if there are no constraints. But with constraints, the minimum might be on the boundary.
Formula: For unconstrained quadratic optimisation, minimum of \( ax^2 + bx + c \) is at \( x = -b/(2a) \).
common mistakes: forget constraints
One of the most common mistakes is to ignore constraints. Remember that the best solution is only valid if it satisfies all constraints.
Warning: Always check that your solution satisfies all constraints. For example, if you find a solution that maximizes profit but exceeds your budget, it's not valid.
practice: planning a trip
Let's say you want to plan a trip to three cities with a budget of 300 JDs. The costs to travel between cities are:
- A to B: 50 JDs
- A to C: 80 JDs
- B to C: 30 JDs
What's the cheapest route that visits all three cities?
Possible routes:
- A → B → C: 50 + 30 = 80 JDs
- A → C → B: 80 + 30 = 110 JDs
- A → B → A → C: 50 + 50 + 80 = 180 JDs (more expensive)
The best solution is route 1, with cost 80 JDs.
summary: takeaways key
Let's recap what we've learned:
- ت optimisation is about find best solution within constraints.
- Objective function is what we want to maximize or minimize.
- Constraints define feasible region.
- Always check that your solution satisfies all constraints.
Key point: ت optimisation is everywhere, from daily decisions to complex engineering problems. Start by defining your objective and constraints clearly.