Introduction to Optimization and Intersection with Artificial Intelligence

9 min readMay 10, 2024

When presented with several choices, the natural way to make a decision is to choose the best one. How we choose and measure the “best” choices can depend on the type of scenario or the problem. These scenarios can be from choosing the right items for a camping trip or blending cat food to scheduling the production of an industrial complex. These problems can be viewed as optimization problems if there is one or more goal that can be optimized.

Now what do we mean by optimization? There are multiple interpretations of the term “to optimize”. However, let’s take a look at one that provides a simple explanation of the core ideas of optimization.

To optimize = to do something as well as is possible

“Do something” could be identified as the activities or the decisions that can be made regarding the problem. Each of these activities is tied to a variable, where the value or activity level must be determined. However, there might exist some variables that values can not be changed. These values are considered constants.

“Well” indicates how good the decisions made are have to be measurable. This measured value is to be given a highest or lowest value, that is, we minimize or maximize, depending on our goal.

“Possible” expresses the limiting factors that are inherent to the problem. These factors can be the amount of time, money, or labor, which are normally not unlimited for the tasks we wish to optimize. One has to also consider the business logic or the operational logic that might dictate how far the decisions can be adjusted.

Text-based Formulation of an Optimization Problem

Fig. 1: Blending of cat food using different ingredients. [1]

Given that the task is to create a cat food blend from different ingredients, we can align the different aspects of this task to the definition to formulate an optimization problem. To start off, there are different ingredients so the decisions that can be made would be the ratio of the ingredients in the blend. Next is the price of the ingredients which will affect the cost of making the blend. These prices can be viewed as constants. The constraints would be the sum of all the ingredient ratios must be one and also the final blend must meet the nutritional requirements for cats. Lastly, we need to define what is considered a good blend or our goal. Since we would want to make cat food that can fulfill a cat’s nutritional needs with the least amount of ingredient cost, the most straightforward one would be the cost of the blend.

Fig. 2: Cats eating optimally-blended cat food.

Mathematical Formulation

The next step is to make a formal optimization model that can represents the problem mathematically. Formal optimization modeling offers the advantage of considering the effects of alternate decisions simultaneously to yield the best overall decision based on the objective. Humans can only consider a few factors at the same time. As the size and complexity of a problem expand, it becomes challenging for humans to fully comprehend all the effects of a decision. Large-scale optimization software can manage thousands or even millions of decision variables and constraints. However, human intelligence is still needed to define the problem or verifying the formulation, as well as in interpreting the results of the computer solution. Computer algorithms excel at taking a well-formulated problem definition and performing the necessary computations to produce the best solution.

An optimization problem is generally presented in the form of a well-defined mathematical model. This model is the mathematical representation of a system or a real-world situation that needs to be optimized. Similar to the fundamental definition of optimization, a model is composed of three primary components: decision variables, the objective function, and constraints.

The decision variables are the elements or factors that we have the power to alter or adjust within the problem. They represent the decisions that we can make to influence the outcome. In other words, they are the variables that we have control over.

The objective function, on the other hand, symbolizes the goal or the target that we aspire to reach. It is the value that we aim to minimize or maximize depending on the nature of the problem. This function essentially quantifies the performance of the system based on the decision variables.

Lastly, the constraints are the restrictions or limitations imposed on the problem. They define the permissible range or boundaries within which the decision variables can vary. These constraints could represent physical limitations, capacity restrictions, available resources, or any other restrictions that limit how big or small the variables can get.

A simple representation of such a model might look like the following:

Fig. 3: A simple optimization problem.

From Fig. 3, the first row indicates that the variable z is to be maximized. This statement represents the objective function that calculates the value of z. Further analysis reveals that z can be derived from two variables, x1 and x2. Consequently, these two variables, x1 and x2, are our decision variables. The information following the phrase “subject to” represents the constraints, which determine the extent to which x1 and x2 can be modified.

Enhancing Business with Optimization

In the business world, optimization is an important step to try to achieve the best level that the business can function. The difficulty of an optimization problem or the technique need to solve it may depend on various factors, such as the complexity of the problem, the number of variables involved, and the constraints within which the solution must be found. For instance, determining the optimal inventory level for a retail store might involve balancing storage costs, sales forecasts, and supplier lead times. Some other common examples of optimization problems include:

  • Production Planning

In production planning, the goal is to determine the optimal level of production to meet demand, while minimizing costs and ensuring efficient use of resources. Optimization can also improve workforce scheduling which involves assigning employees to shifts in a way that meets business needs while also considering employees’ preferences and labor laws. The goal is to maximize efficiency and productivity while minimizing labor costs.

Fig. 4: An example of oil and gas supply chain. [8]
  • Supply Chain Optimization

Inventory planning involves determining the optimal amount of stock to keep on hand. It requires balancing factors such as storage costs, lead times, and anticipated demand to minimize costs while ensuring products are available when customers need them.

Fig. 5: Diagram of a supply chain. [6]
  • Energy Management

Optimization can help improving the efficiency, reliability, and sustainability of energy management systems. Optimizing an energy management system ultimately leads to cost savings, environmental benefits, and a more resilient energy infrastructure.

Fig. 6: An example of energy production system. [7]

These are just a few examples of the many ways in which optimization techniques can be used to improve decision-making and efficiency in various businesses.

The Intersection with Artificial Intelligence

Artificial intelligence (AI) is a powerful tool to analyze large datasets and identify patterns which can help expands the number of approaches available to solving optimization problems. We can utilize AI to predict outcomes from the different settings of decision variables and make more informed decisions, thereby enhancing the quality of the solutions. The predicted outcomes might be related to the objective function such as estimating the amount of product from a chemical process given a set of input. Numerous business case studies and academic researches have used results from AI as components of optimization models.

Refinery planning

Optimization of a refinery production can be done by combining deep learning and optimization algorithm for refinery planning under price uncertainty. A large-scale mixed-integer linear programming model is proposed, using fixed-yield models of processing units and considering uncertain product prices. Historical data is used to construct an uncertainty set, and a deep learning method is employed to capture price uncertainties. A data-driven robust optimization model is developed and solved using an iterative constraint generation algorithm. The method is demonstrated to be effective through case studies from an actual refinery, achieving a better trade-off between robustness and optimality.

Fig. 7: The flow chart of different units in the refinery. [3]

Inventory management

Traditional methods of inventory management often depend on reactive strategies, where inventory decisions are based on historical data and intuition. This traditional approach can be time-consuming and susceptible to errors, leading to situations of stockouts or overstocks. However, machine learning provides a more proactive approach to inventory management, as the algorithms can analyze massive amounts of data in real-time. As a result, businesses can adjust their inventory levels and reorder points based on actual demand, leading to optimal inventory levels and reduced carrying costs. Machine learning can aid in reducing the risk of stockouts and overstocks. By accurately predicting demand and adjusting inventory levels and reorder points in real-time, businesses can ensure that they have the right products in stock when customers need them. Without reduction of the risk of stockouts there can be negative impact on customer satisfaction and result in lost sales. Simultaneously, machine learning algorithms can help businesses avoid overstocks, which can tie up capital and increase carrying costs.

Solar energy system optimization

In a solar energy system with batteries, one key thing to consider is the significance of lithium batteries in addressing energy storage challenges. It emphasizes the importance of optimizing battery capacity to avoid waste and cost escalation. Power consumption variability in industrial settings necessitates a model for efficient energy dispatch and storage management. The proposed model integrates solar power generation, electricity consumption, and battery installation data to optimize energy management, aiming to minimize operational costs while meeting grid demands. Simulation results demonstrate the model’s efficacy, achieving higher energy optimization in distributed systems compared to other strategies. Despite promising results, current lithium battery prices hinder widespread adoption due to high operational costs. The study suggests that reducing battery prices is essential for cost-effective energy storage implementation. Overall, the developed model shows promise in addressing energy scheduling challenges and reducing operational costs in industrial contexts.

Fig. 8: Diagram of energy management framework. [5]


Optimization, the process of making the best possible decision among several choices, is crucial in various scenarios, from everyday decisions to complex business problems. An optimization problem typically consists of decision variables, an objective function, and constraints. Examples in business include production planning and workforce scheduling, inventory planning, and energy system optimization. Artificial intelligence can assist in solving optimization problems by analyzing large datasets, predicting outcomes, and making more informed decisions.


[1] Phillips, A., & Mitchell, S. (2007). A Blending Problem. A Blending Problem — PuLP 2.8.0 documentation. A Blending Problem — PuLP 2.8.0 documentation

[2] Andréasson, N., Evgrafov, A., & Patriksson, M. (2005). An introduction to optimization: Foundations and fundamental algorithms. Chalmers University of Technology Press: Gothenburg, Sweden, 1, 1–205.

[3] Wang, C., Peng, X., Chen, S., Chen, F., Zhao, L., & Zhong, W. (2021). A deep learning-based robust optimization approach for refinery planning under uncertainty. Computers & Chemical Engineering, 155, 107495.

[4] Chaudhary, V., Bharadwaja, K., Meena, R. S., Bikash, P., Acharjee, D. N. C. C., & Gopinathan, R. (2023). Exploring the Use of Machine Learning in Inventory Management for Increased Profitability.

[5] Rubavathy, S. J., Kannan, N., Dhanya, D., Shinde, S. K., Soni, N., Madduri, A., Mohanavel, V., Sudhakar, M., & Sathyamurthy, R. (2022). Machine Learning Strategy for Solar Energy optimisation in Distributed systems. Energy Reports, 8, 872–881.

[6] Liu, Z., Huang, R., & Shao, S. (2022). Data-driven two-stage fuzzy random mixed integer optimization model for facility location problems under uncertain environment. AIMS Mathematics, 7(7), 13292–13312. Data-driven two-stage fuzzy random mixed integer optimization model for facility location problems under uncertain environment

[7] Serrano-Areválo, T. I., Juárez-García, M., & Ponce-Ortega, J. M. (2020). Optimal planning for satisfying future electricity demands involving simultaneously economic, emissions, and water concerns. Process Integration and Optimization for Sustainability, 4(4), 379–389.

[8] Ghaithan, A. M. (2020). An optimization model for operational planning and turnaround maintenance scheduling of oil and gas supply chain. Applied Sciences, 10(21), 7531. An Optimization Model for Operational Planning and Turnaround Maintenance Scheduling of Oil and Gas Supply Chain