University › Artificial Intelligence and Data Science › AI / Optimization Methods
Mathematical Formulation of an Optimization Problem
Write the decision variables, objective function and constraints separately for a given real problem. Check whether a point lies in the feasible set.
Learning Outcomes
- Can write decision variables, target function and constraints separately for a given real problem.
- It can determine whether a point falls into the feasible set by checking all constraints.
- Can explain the difference between local optimum and global optimum with an example.
- It can transform the enlargement problem into the smallest form and bring it to standard form.
Topic Explanation
What optimization is and why it is needed
Optimization is the process of finding the decision that best achieves a measurable metric among the options we have. In daily life, choosing the shortest route of a journey, distributing a budget in the most efficient way, or minimizing the prediction error of a model has the same structure. In every case, there are quantities that we can change, a criterion that we want to improve, and conditions that limit this criterion. Writing these three elements explicitly turns an intuitive choice into a solvable math problem.
The first step when setting up an optimization problem is to determine the decision variables. Decision variables are numbers that we control and whose values we choose; these are collected in a vector. The second step is to write an objective function that depends on these variables; It boils down to a single number how good our choice of target function is. The third step is to express real-world boundaries as equations or inequalities. Thus, the problem becomes "find the point that gives the smallest (or largest) value of the target function among the variable values that satisfy certain conditions."
The importance of this setup is not just the mathematical order. When the goals and constraints are written clearly, it becomes visible what assumptions are made; One can question why a solution was chosen and compare different solutions with the same criteria. An optimization with incorrectly selected criteria does not meet the real need, even if it produces a technically correct solution. Therefore, modeling is a step that comes before the algorithm and is at least as critical.
Decision variables, objective and constraints
A standard optimization problem is written in minimization form as: minimize the function f(x) on the decision vector x; In addition, let the inequalities g_i(x) ≤ 0 and the equations h_j(x) = 0 be satisfied. Here f is the target function, g_i and h_j are constraint functions. The maximization problem can be reduced to the same form by minimizing the negative of the target; This conversion makes the installation uniform.
Decision variables can be continuous, integer or binary. For example, in a production plan, the quantities to be produced are continuous, and whether a facility is opened or not is a binary variable. The type of variable directly affects the method to be used: derivative-based methods work well for continuous variables, while combinatorial search is required for binary variables. Making this distinction up front avoids unnecessarily selecting an unsuitable algorithm.
Constraints narrow the solution set. Inequality constraints impose an upper or lower bound; Equality constraints establish a strict connection between variables. The points that satisfy all the constraints at the same time form the feasible set. If no point satisfies all the constraints, the problem is infeasible; This is not the fault of the algorithm, but a sign that the model is set up incorrectly. It is therefore important to check whether the constraints are consistent during the modeling phase.
Feasible set and optimal solution
The feasible set is the collection of decision vectors that satisfy all constraints. In a two-variable problem, this set can be visualized as a region in the plane; It can be thought of as a three-dimensional solid or, in higher dimensions, as an abstract polyhedron. The best value of the target function on this set is the optimum of the problem. In order for the optimum to exist, the set must not be empty and the target must remain limited in this set.
Optimal solution is used in two senses: local and global. A local optimum is a solution that is best only relative to nearby points; The global optimum is the best in the entire feasible set. Every global optimum is also local, but not every local optimum is necessarily global. This distinction becomes especially clear in nonlinear problems; An algorithm may get stuck on a local point and miss the global solution.
Proving that a solution is optimal is often harder than finding the solution. For this reason, stopping criteria are used in practice: such as the target value no longer changing significantly, the step size decreasing, or the derivative approaching zero. These criteria do not definitively prove the optimum; It just shows that it's close enough. The reliability of the result depends on the suitability of the criterion used to the problem structure.
Modeling steps and solution verification
A good modeling process consists of four steps. First, the decision variables and units are written. The target function is then constructed so that its units are consistent; for example, cost is in currency, duration is in hours. Constraints are then added to reflect physical, legal or operational realities. Finally, the model is fed with the available data and it is checked whether the solution is meaningful to real life.
Model validation involves seeing that the solution actually satisfies the constraints and that the target value is reasonable. If a production quantity that is impossible to be negative turns out to be negative, the total resource exceeds the current capacity, or the target deviates from the expected size, this indicates that there is an error in the model. Such checks are performed after the algorithm is completed and often reveal that the constraints were written incorrectly.
Criteria selection is also part of validation. The same decision problem can be modeled with different objectives: maximizing service level rather than minimizing cost. When the target changes, the optimum also changes. Therefore, ensuring that the target function represents the true purpose determines the acceptability of the technical solution. Clarifying this criterion with stakeholders is an invisible but critical part of modeling.
Classification and approach by problem type
Optimization problems are classified according to the structure of the goals and constraints. If the target and all constraints are linear, there is linear programming; if at least one of them is non-linear, there is non-linear programming. If the variables are integers, integer programming comes into play. If there are no constraints, problem-free optimization is mentioned; if the target is single, single-objective optimization is mentioned, and if there is more than one goal, multi-objective optimization is mentioned.
Classification determines the choice of method. In linear problems the global optimum can be found reliably; In non-convex problems, there may be more than one local optimum and the starting point affects the result. Derivative-independent methods are preferred in cases where derivatives cannot be calculated or the variables are discrete. Specifying the class of the problem incorrectly carries the risk of producing a working but incorrect solution.
In an applied approach, the simplest model is first established, and after the solution is analyzed, the constraints are gradually realised. This iterative approach allows to see which constraint changes the outcome. If an overly complex model is built from scratch, its solution becomes difficult and it is not clear which assumption is decisive. Moving from simple to complex is one of the most productive strategies in modeling.
Step-by-step review of a sample formulation
Let's assume that in a workshop producing two products, the profit per product is known and there is limited raw material and labor capacity. Decision variables are the production quantities of two products. The target is written by adding the unit profits multiplied by these amounts. The constraints are that consumption of raw materials and labor does not exceed existing capacities; Additionally, production quantities cannot be negative. This setup is a two-variable, linear maximization problem.
It is a region with cluster vertices that can be applied after the installation is completed. The optimum of the linear target occurs in a corner or on an edge of this region. This observation makes it possible to arrive at the solution by examining a limited set of candidate points. To find the corners, the binary matches of the constraint equations are solved and those that satisfy the constraints are preserved.
This example shows all the basic elements of modeling: variable, goal, constraint, feasible set, and where to look for the optimum. The same pattern applies to a logistics route, an investment allocation, or the parameters of a machine learning model. The only things that change are the number of variables and constraints and the form of the goal; The mindset remains the same.
Key Points
- Decision variables are the elements that are controlled, the target function is measured, and constraints are the elements that set limits.
- The standard form is min f(x), g_i(x) ≤ 0, h_j(x) = 0.
- If the feasible set is empty, the problem is infeasible; This is not an algorithm error but a model error.
- The global optimum is always local; The local optimum does not have to be global.
- Target units must be consistent; Money, duration and quantity should not be confused with each other.
Worked Examples
Worked Example
Worked Example
Worked Example
Worked Example
Common Mistakes
- Choosing an algorithm directly without writing the target function.
- Not writing the units of the constraints consistent with the goal.
- Reporting the local optimum found as global optimum.
- Overlooking that the applicable set may be empty.
Tips
- As the number of constraints increases, the feasible set becomes smaller and the optimum may change.
- When the same decision problem is modeled with different objectives, different optima are obtained.
- Inconsistent constraints are a modeling error that can be detected before a solution is sought.
- Proceeding from the simple model to the complex shows which assumption is decisive.
Practice Questions
- 1. What structure do decision variables, target function and constraints come together to form?
- 2. What is the purpose of the target function producing a single number?
- 3. Which is the set of points that satisfy all the constraints at the same time?
- 4. Which statement is true for local optimum and global optimum?
- 5. What can be done to bring the magnification problem to standard form?
- 6. What happens when the applicable set is empty?
- 7. In what form is the equality constraint written?
- 8. What does it mean if the decision variable is binary?
- 9. What is the smallest value of the target f(x)=x²?
- 10. What should be checked least in model validation?
- 11. What does having multiple local optima cause in nonlinear problems?
- 12. Which of the following is not a constraint type?
- 13. What does the box constraint mean?
- 14. Which one is absolutely true if x* is optimum in the min f(x) problem?
- 15. Why is it important to clarify the criteria with stakeholders in modeling?
- 16. How to find corner candidates in a two-product maximizing example?
- VOLUME 17 What advantage does having a problem be convex provide?
- 18. What should be done if negative production quantity appears in the solution?
- 19. Why does problem classification affect method selection?
- 20. What does "consistency of constraints" mean?
- 21. What error does consistency in target function units prevent?
- 22. What is the benefit of the simple to complex modeling strategy?
- 23. What is the maximum value of the problem Max f(x) = −x² + 4x?
- 24. What is the main difference between integer programming and continuous optimization?
- 25. What does one do to determine whether a point is feasible?
- 26 What condition is necessary for optimum to exist?
- 27 What does the term "argmin" refer to?
- 28 Does the optimum point change in the magnification transformation?
- 29 In which case does the boundary occur for the inequality constraint g(x) ≤ 0?
- 30 In what situation does the algorithm often get stuck in a non-convex problem?
- 31 How does the feasible set generally change when the number of constraints is increased?
- 32 In what area of the optimization model is "unit consistency" particularly critical?
- 33 Why is it difficult to prove conclusively that a solution is optimal?
- 34 What does using shrinkage of target change as the stopping criterion indicate?
- 35 In the two-product example, which size should the units of profit be compatible with?
- 36 Are "infeasible problem" the same as "unsolvable problem"?
- 37 In which problem type is examining pairwise couplings of constraint equations useful?
- 38 What does making assumptions visible in the problem setup provide?
- 39 Which of the following could be a decision variable?
- 40 What is the difference between optimum value and optimum point?
- 41 What would the feasible set be like if all the constraints in a model were equal?
- 42 What is the fundamental role of optimization in engineering?
Source: Inspired by open curricula of Turkish universities; the explanation is written originally.
Kaynak: Türkiye üniversitelerinin açık ders planlarından esinlenilmiştir; anlatım özgün olarak yazılmıştır.