# Collection from other sources

# Day 1: Demystifying Operations Research

Welcome to day 1 of #ORfrom0to1! 🙌🏻

Starting this course puts you in an advantageous situation. You’ll be ahead of 99% of people when dealing with making data-driven decisions.

But let’s go concept by concept, problem by problem, day by day.

By the end of this first day you’ll have learned:

The definition of Operations Research

Typical problems you may find in this field

A game to break the ice between you and OR

And I don’t break my words so you’ll also find your first exercise to start thinking about solving these kinds of problems.

Are you ready? Let’s go for it!

# 📚 What Operations Research is and why you should care

Data, data and more data!

That’s something you probably heard a lot in the past few years.

It’s like if you don’t have data in your company, you’re lost. And well, that’s pretty accurate since other companies are doing it too, so you could fall behind.

You want data to visualize what is happening.

You want data to even do some predictions at some core parts of your business.

But what about the present? What about making a plan, schedule, or a route more cost efficient? What about making data-driven decisions to optimize pretty much every process that you have?

Operations Research (OR) is a discipline that deals with the application of advanced analytical methods to help make data-driven decisions.

By using techniques like mathematics, computer science, and business knowledge, OR provides the tools to solve complex problems and improve decision-making processes.

You, as an Operations Research Engineer, would need to:

Collect and analyze data

Develop and test mathematical models

Interpret the information provided by those models

Propose solutions and recommendations to implement improvement actions

So businesses will be able to optimize a cost function.

This a broad field as you can see:

So during this course you are going to focus on:

Understanding the big picture of Operations Research

Start solving some optimization problems on your own through games and exercises

But don’t get me wrong, even though there are a lot of sub-fields here, OR has lived with us for a long time.

It originated during the second world war when it became apparent that the military needed to solve some of the significant logistic and supply chain problems that come with being in war.

Back then, it was defined as "a scientific method of providing executive departments with a quantitative basis for decisions regarding the operations under their control" and was coined "operational analysis" or "quantitative management".

And it has a looooot of use cases that range from supply chain management (moving goods at the lowest cost) to scheduling and assignment problems (so you end up with perfect assignments of tasks to workers), multi-criteria decision making (what about dealing with minimizing costs and at the same time equally distribute those tasks?) or even biology (for finding similarities between molecules that could lead to cheaper drugs for new diseases).

So optimization is everywhere, and thus Operations Research.

It has a huge economic impact in any field and it’s directly applicable to the business.

Let me tell you something: making decisions is hard, so as much data-driven you are, the better for making good decisions. And those decisions are usually driven by three facts:

The decision itself (do I need to assign this task to this person? do I need to go to this place or this other one to deliver my products?). This will be translated as variables, because they can vary their value until you get the best possible one.

The limitations that you have (I cannot assign tasks to this person because she has a different role, I cannot assign more than 40 hours a week of tasks to any person, I cannot do routes of more than 400 km per day). Those are the constraints of the problem.

The criteria for success (I want to minimize the number of people working on this task, I want to minimize the cost of the routes I need to operate, I want to maximize the revenue at my production plant). This is what we call the objective function because, yes, it’s a mathematical function.

Ok, enough Operations Research theory today! Let’s see some problems you can find out there.

# 🔢 3 typical problems you can find

I know, I know.

I’ve just said that you can find problems in -almost- every industry, right?

But of course there are some industries more mature than others. Let’s say they have been playing around OR for more time, they found its value earlier. So there’s really an spectrum of problems to solve, ranging from resource allocation in logistics to scheduling in manufacturing and services.

All these problems often involve optimizing products, processes, or services within constraints to achieve the best outcome. And here’s the thing:

Understanding these typical problems is crucial for applying OR techniques effectively in any other problem you find out there.

Let’s see 3 real-life problems you can easily find in the optimization literature.

## 🛻 Transportation Problem

Let’s imagine you are the manager of pORfumes supply chain, the most successful perfume brand of your country. So you are responsible of taking care of each step of the process between getting the glass for the perfumes to get them to the manufacture plant.

You have several places for getting the glass at different prices and different maximum quantities, and you need to deliver it to different manufacturing plants, each of them with a different maximum capacity and cost to produce the perfumes.

If you want to cover the demand of perfumes in the market, what would be the best combination of matching the places where you get the glass with the manufacturing plants at the minimum possible price covering all the demand?

And here you have your first optimization problem as the pORfumes company.

The transportation problem involves finding the most cost-efficient way to distribute a product from several suppliers (in this case, the places where you get the glass) to several consumers (the production plants and ultimately the customers) such that the product is shipped in the most economical way while satisfying supply at the suppliers and demand at the consumers.

The goal is to minimize the total transportation cost, and it is typically formulated as a linear programming problem.

## ⚙️ Production Planning Problem

Now imagine that you are the manager of one of those manufacture plants of pORfumes.

You want to produce the bottles of the perfumes, so you have a bunch of materials like glass, plastic for the cap, and stickers for different sizes of perfumes. You have minimum requirements in terms of quantities of each perfume but also some unexpected, on-demand production.

Considering that changing materials is difficult because it adds time to the production planning but also adds some costs because you need to change some machinery, what do you need to do if you want to cover the demand at a minimum price?

Exactly, you need to solve an optimization problem that deals with planning!

## 🗺️ Traveling Salesperson Problem

Let’s imagine now you are the salesperson for pORfumes, so you have a car and you deliver perfumes to several stores in different cities.

What will happen tomorrow first thing in the morning? That’s it: you need to pay a visit to all of them, but just once. And at the end of the day, come back home. In the end, you perform a loop over all the stores. But of course you want to do it in the least amount of time. Easy, right?

This is one of the most studied problems in the literature, and there are lots of variants to it, like:

📅 What happens if you need to pass through each store in a certain period of time? Then you have the Time Windows variant.

🚧 And what if you have a capacity limit that you cannot exceed in your car? Then you have the Capacity variant.

📦 What about delivering some perfumes in the store but at the same time picking other things like boxes you left there? Then you have the Pickup & Delivery variant.

(Yes, I know that the names of the variants are far from being original, they are just descriptive.)

We can even transform this problem into a bigger one, so instead of having just one car you have a fleet of cars. This is a generalization of the problem and it’s called the Vehicle Routing Problem.

As you are thinking now, solving these problems is crucial for logistics companies. They need to deliver products to places paying the least possible amount of money! 💸

If you want to read more about these problems, I already talked about the Travelling Salesperson Problem and the Vehicle Routing Problem on Feasible.

You may wonder why I chose these 3 problems.

The thing is those specific problems are easy to understand since they might be in our daily lives and they may be used in other contexts too.

So understanding those problems will give you a better sense to understand a broader range of optimization problems. And you will even start seeing optimization problems everywhere!

For instance, the Transportation Problem can be used to efficiently assign tasks to workers in a workforce optimization problem. The Production Planning Problem can be used in other industries like car manufacturing or batch production of drugs in the pharma industry. And the Travelling Salesperson Problem can be used to solve computer wiring problems or even in assembly lines to optimize the sequence of operations.

And I want you to play with them. I mean, literally.

During the following days, you are going to either play, either solve, or both things at the same time with those 3 problems, so you can get the big picture of Operations Research.

The first game starts now 👇🏻

# 👾 Let’s play ArcadeTSP

Arcade games. So 80’s, huh?

They became popular for some reasons: easy gameplay, short duration of games, and the possibility to play with other players, mainly.

What they didn’t expect at all is that they would serve a purpose in optimization some decades later. In particular, to help us understand the Travelling Salesperson Problem in a better way.

The ArcadeTSP is an arcade game based on the aforementioned problem that will help you visualize the challenges of routing, commonly faced in logistics and delivery services. By attempting to find the shortest possible route that visits each point and returns to the origin, you'll get a hands-on experience of the complexities involved in optimization problems.

This exercise will prepare you for the more complex scenarios we'll tackle later in the course since it will introduce you to some of the core concepts of Operations Research.

How to play the game?

1. Go to → https://bmenendez.github.io/arcadetsp/

2. Click on several places of the yellow square to create those cities to go through them, like:

3. Click on the PLAY button at the bottom.

4. Connect the dots in such a way you think you minimize the total travel time, like:

5. Click on the CHECK button at the bottom, and you’ll see if an algorithm could beat you!

It’s your turn now! Happy playing!

# 🏁 Wrapping up

OK, that’s a lot of new concepts for just one day! Let’s recap a little bit to see what you accomplished today:

You have seen what Operations Research is, and I hope you found it as beautiful as I see this field.

You have been the manager of supply chain and manufacturing plan for pORfumes, as well as a salesperson, understanding what are the optimization challenges of each role.

You played an arcade game to understand the basics of the Travelling Salesperson Problem, playing against a machine that I hope you could beat.

# ✍🏻 The exercise

Yes, you guessed it right, I want you to show me how good you are on ArcadeTSP.

This time I lost, what about you? Let me know answering this email with a screenshot 😊

But more importantly, I’d love to go deeper on this, so consider thinking:

What did you find more interesting?

What did you find more difficult?

Did you find any special strategy to always beat the algorithm? What was it?

And I’ll also want you to think about if you found optimization problems in the past. Did you think they had a proper area of knowledge that helps you solve them? Have you ever found yourself looking at a decision to make but you find it very difficult to take action?

I’ll be delighted if you answer these questions and even rise more! Would you tell me your answers to this email?

That’s it for today, I hope you enjoyed this first day!

Tomorrow we’ll cover how to identify optimization problems at your company, previously identifying different layers of management that are prone to these problems. And we’ll see together a new problem that you will be modeling and solving in the following days.

See you tomorrow!

Borja.

# Day 2: Identifying optimization problems at your company

Welcome to day 2 of #ORfrom0to1! 🙌🏻

You know, I’ve always thought that there are no Operations Research projects, just business ones.

I mean, there’s no point in applying OR techniques to unexisting problems. If you’re solving a problem that no one is facing, then that solution will be irrelevant.

So you need to understand how a company manages its business so you can spot problems that you can solve (hopefully, with OR techniques 🤞🏻).

By the end of this second day you’ll have learned:

Applying OR to several layers in businesses

How to identify optimization problems at your company

The Furniture Factory Problem: will you be able to maximize revenues?

Are you ready? Let’s go for it!

# 💼 Applying Operations Research to several layers in businesses

Every company faces lots of decision-making processes each day.

From figuring out how to improve the business for the next 6 months to the daily decisions that make the company profitable.

And some of them can be treated as optimization problems.

We have already seen that you can leverage Operations Research to reduce costs, increase revenues, or make better plannings.

But how?

Well, let’s divide the company into three different levels of management: strategic, tactical, and operational.

You can find optimization problems at each of those three levels, and we’ll see two specific examples. But first, let’s define each of them:

Strategic problems involve high-level, long-term decisions aimed at positioning the organization competitively in its environment over the long haul. It's about setting overarching goals and priorities and understanding the market and industry trends.

The focus is on shaping the future landscape of the business and its growth trajectory, often based on simulations and scenario planning.

On the opposite side, operational problems are the most immediate and detailed layer, concerned with the day-to-day operations of the business. This level of planning addresses the implementation of specific tasks through efficient processes and problem-solving in real-time.

It focuses on making quick, feasible decisions to keep the business running smoothly every day.

Tactical problems bridge the gap between strategic and operational problems, focusing on medium-term goals and how to implement strategies effectively. It's more specific than strategic problems but broader than operational ones.

Let’s see an example 👇🏻

### 🚚 Planning problems when moving goods across Europe

As you know, I’m working at a logistics startup called Trucksters.

We mainly move goods from one place to another. Not me, drivers with trucks! So they need to know what their next place to go to get a load. That’s a plan, right? You tell the driver where to load, what to get and where to unload. That’s a task for planners.

Operational planning

Planners need to make adjustments on their plans on the go because there might be some unexpected issues on the road (like weather or traffic conditions) or at warehouses (like they couldn’t do the unloading for whatever reason).

And at the same time they need to understand that those adjustments are feasible, so they can make it real.

You cannot tell a driver to move 120 km in just one hour just because you find that truck is the nearest one to the next load. You cannot tell a driver that goes with a particular type of trailer to do a loading that requires a different type of trailer. You cannot tell a driver to go to Luxembourg if there’s a national holiday and trucks cannot go there.

You get the point, right? Those are impossible actions to do in real life.

Those are decisions to be made in the daily life of a planner.

But let’s say this is just a survival part since there’s not so much range of action you can take. You need to make fast decisions with the resources you have.

What if you can do a different planning?

Tactical planning

Planners also need to foresee a complete schedule for the current + next week. This way they have a wider vision of what to do, a guideline for the rest of the week.

They have all the possible routes with their own constraints (loading and unloading date, loading and unloading location, type of trailer needed for the route), and they figure out how to combine them in the best possible way to get to a goal, like minimizing empty km (those empty trips that a driver need to do).

This is close to operational planning since they need to understand the feasibility of that weekly planning, but it gives them a different perspective of the planning ahead.

How could we foresee a bigger picture?

Strategic planning

Businesses not only live with operational and strategic planning. They also need to think ahead to new ways of doing their stuff.

Talking about logistics, it’s pretty common to understand routines that need to be done by drivers, so you can get to the market and get better contracts with them since you can offer something specific.

Or you analyze how you can improve your margins just out of moving the schedule for some loads (sometimes it’s better to load 2 hours later than expected so you can easily task a specific driver to do it) so you can go to the client and renegotiate the terms of the contract.

Or you can see the impact of revenues and costs on your plannings with the conditions that you currently have + new ones that may come in the future.

All of this can be done through simulations. You simulate different scenarios with those different what-ifs that you have just seen, pick the best one for your future business, and then start taking action to make it real.

# 🔍 How to identify optimization problems

Well, first of all, you don’t really need to find optimization problems per se.

I mean, you’ll look for ineficiencies, bottlenecks and other ways to solve the issues the company is facing. This involves identifying areas where complex decisions need to be made efficiently and effectively.

And right after that, then you’ll be in a better position to understand if Operations Research is the tool you need to solve them. Sometimes it is, sometimes it’s not. OR is a tool inside your toolbox, so use it wisely. Do not do OR for the sake of OR.

Having said that, here’s a generalized approach to recognize OR opportunities at your company:

Identify bottlenecks, inefficiencies or excessive costs

Look for processes or systems within your industry that are frequently bottlenecked, where delays and inefficiencies occur. These might be physical (e.g., slow production lines, traffic jams, network congestion) or procedural (e.g., slow decision cycles, inefficient resource allocation).

Identify areas where costs are significantly high or could be reduced through better management. This includes direct costs like inventory and logistics, and indirect costs like customer dissatisfaction due to poor service.

Anyplace where there are long wait times, excess inventory/capacity, underutilized resources, or general inefficiencies is a prime opportunity for OR.Look for complex decision-making environments

Spot scenarios where decisions involve multiple variables and stakeholders, which can benefit from sophisticated decision-support tools.

Some common decisions that may benefit include:Allocating limited resources (money, people, materials, etc.)

Maximizing or minimizing some quantitative measure (cost, profit, time, etc.)

Determining optimal configurations/mixes (product assortment, asset allocation, etc.)

Routing vehicles or scheduling activities

Making tradeoffs between service level and efficiency

Consider scalability and impact

Identify areas where small improvements can scale significantly or have a substantial impact on the business or its customers.

For example, if you have to plan tasks, you will have realized that introducing more people to do it manually does not make the problem easier to solve.

As you have more and more tasks to plan, the problem becomes so complex that when you add more hands, you neither obtain higher quality solutions, nor will you solve it in less time.

OR is particularly valuable where small automations in processes can lead to large gains in efficiency or customer satisfaction.

*customer satisfaction may range from delivery times to customer service interactions and product quality, that may be a candidate for OR to shine.

That’s OK, but how could you do that? There are several ways and things to take into account:

Start with processes

I love starting with processes. This is a deep exercise to make through all the departments of the company, but you can start with one and repeat the process in the rest of them.

Start asking questions about what decisions most affect your results.

Begin this journey with in-depth discussions with your seasoned executives who understand the nuances of these processes and can also see the bigger picture.

Typical kickoff questions include "where do you perceive opportunities for improvement?" or “what are your major bottlenecks?”.

There might be different examples like in production planning if you’re facing backlogs due to inefficient machine utilization, or in warehousing if you have high picking costs due to excessive walking when retrieving orders.Data collection and definition of problems

Determine what operational data already exists and what new data may need to be collected. This could include data on demand, capacities, costs, travel times, service levels, etc. The ability to quantify the important factors is crucial for optimization.

Define the key performance metrics and objectives the organization wants to optimize. This could be minimizing costs, maximizing outputs, improving customer service levels, increasing efficiency, or balancing trade-offs.

Explicitly list out the various constraints and limitations on the system such as budgets, capacities, labor rules, serviceable regions, etc. These form the boundaries for the optimization.External perspectives

Simultaneously, tap into external wisdom through consulting firms or academic and industry literature.

Consultants can provide insights into best practices and trends, while literature might reveal how peers are tackling similar challenges.

Take the insights from the above steps and precisely formulate the core decision problems that could be tackled using mathematical modeling, optimization, simulation, or other OR methods.

Finally, evaluate the potential impact, costs, data requirements, and feasibility of the identified opportunities. Prioritize the highest value use cases to pursue first.

The key is deeply understanding the organization's operations, objectives, constraints, and available data to properly frame the decisions into an optimizable problem format.

# 🪑 The Furniture Production Problem

So let’s start with a new problem.

Today, you will put yourself in the shoes of a Data Scientist responsible for developing a weekly production plan of two key products at FurnitORe, the biggest furniture factory in your country.

FurnitORe produces chairs and tables with mahogany wood, and they sold it at:

45$ per chair

80$ per table

There are two critical resources in the production of chairs and tables:

Mahogany (measured in square meters) and labor (measured in work hours)

There are 400 units of mahogany available at the beginning of each week

There are 450 units of labor available during each week

You estimate that:

One chair requires 5 units of mahogany and 10 units of labor

One table requires 20 units of mahogany and 15 units of labor

And the marketing has just told you that all the production of chairs and tables can be sold, so they ask you:

What is the production plan that maximizes the total revenue the following week?

Of course you need to consider that you cannot produce a fraction of chairs or tables. No, there’s no point in having to produce 1.2 chairs or 8.7 tables, right?

Summarizing everything in one table, we have:

So in the end you need to:

Decide how many tables and chairs to make

In order to maximize total revenue

While satisfying resource constraints

This is the problem that you are going to work on for the next 2 days too. You will be able to solve it automatically, with just a few steps from you and the hard part done by a machine.

But first, let’s see how you would solve it… By hand!

# 🏁 Wrapping up

OK, that’s a lot of new concepts for just one day! Let’s recap a little bit to see what you accomplished today:

You have seen that Operations Research is on each layer of management of any company. You can spot optimization problems wherever you go.

But more importantly, you have seen some ways about how to look for them, so now it’s easier for you to understand the biggest problems of your business.

You have seen an informal definition of an optimization problem in plain words, as you could see in your business.

# ✍🏻 The exercise

Now that you understand problems that appear at different layers in any business and how to spot optimization problem, think about the daily operations and challenges you encounter on your company:

Are there any processes that seem inefficient, costly, or time-consuming?

Could you identify any areas that could be improved?

What are their goals?

And their constraints?

What do you really need to decide?

How did you spot those optimization problems?

Did you find any issues on properly defining them?

Since you know about a new optimization problem at FurnitORe, tell me if you have any doubt about it. Think deeply about the problem and try to answer the following questions:

How easy do you see solving that problem?

How would you solve it if you had to do it by hand?

What ideas come to your mind so you can maximize the revenues considering the defined constraints?

Try to find a solution to the problem as hard as you can. Annotate it. Save it somewhere. Or even better: tell me about the solution and how you answered all the questions above.

I’ll be delighted if you drop me an email with all these things.

That’s it for today, I hope you enjoyed this second day!

Tomorrow you’ll understand the fundamentals of optimization so you could translate a given business problem into mathematical formulas. In fact, you’re going to write your first mathematical model that defines the Furniture Production Problem you’ve seen today.

See you tomorrow!

Borja.

# Day 3: Fundamentals of optimization

Welcome to day 3 of #ORfrom0to1! 🙌🏻

Now that you already know what Operations Research is and how to identify optimization problems at your company…

Why not start defining them?

Mathematically speaking I mean.

When working with optimization problems, it’s important not only to define the problem in plain words, but also to define it in the most rigorous language that we have on Earth: mathematics.

Apart from being rigorous, it removes the ambiguity of the language we usually speak, so this is the first critical step in solving optimization problems.

By the end of this third day you’ll have learned:

The basic elements of any optimization problem

How to identify each part in you business problem

How to translate a business problem into those elements

Are you ready? Let’s go for it!

# ⚙️ Basic elements of every optimization problem

A mathematical model describes the reality of your problem, and it consists of 5 different parts.

Understanding these components is crucial as they are the building blocks of mathematical models used in Operations Research:

Sets

Parameters

Decision variables

Objective function

Constraints

Let’s see all of them, one by one.

### Sets

Sets indicate the elements to take into account in the model so we can iterate on them while building the model.

There might be sets for resources that are used in the problem, sets for products that you want to sell, sets for cities that you want to go through, sets for chemical elements in your formulation…

### Parameters

Parameters indicate the constants known at the time of decision-making (before you even start defining the problem) and that need to be taken into account in the model.

This could include things like product prices, resources capacities, coefficients, supply or demand for resources, etc.

### Decision variables

Every optimization problem involves making choices to achieve a desired outcome.

These choices are represented by decision variables, and will determine the quantities to get from a product, or the specific city we need to go through in each step of your journey, or the amount of capacity used of a given resource.

When getting a solution for your problem, you will extract the most important information from decision variables, as they define the key aspects of your brand new solution to the problem.

### Objective function

You need a way to measure how well you’re doing. This is where the objective function comes in.

It quantifies the goal you’re trying to achieve, whether it’s maximizing profit, minimizing costs, or a mix in between. In the end, it’s what needs to be optimized.

### Constraints

Even though we have choices thanks to decision variables, those aren’t limitless. There are always constraints that restrict your options.

These constraints could be limitations on resources, budget, time, or even physical laws. They define the limits within which the problem must be solved.

All these 5 elements sound like nothing when talking without specific examples, so let’s see how to identify them 👇🏻

# 🛠️ Identifying those elements in the Furniture Production Problem

Identifying and defining the componentes of an optimization problem in a real-world context is a skill that requires both intuition and training.

And translating simple, plain words into mathematics is a needed but complex exercise if you want to make data-driven decisions.

Today, we’ll practice identifying these elements in the Furniture Production Problem that you saw yesterday, breaking down the definition that we already have into its basic parts.

That way, you can begin to see how a seemingly overwhelming challenge can be systematically tackled using OR techniques.

Let’s start from the beginning. The problem stated:

🪑 FurnitORe produces chairs and tables with mahogany wood, and they sold it at:

45$ per chair

80$ per table

There are two critical resources in the production of chairs and tables:

Mahogany (measured in square meters) and labor (measured in work hours)

There are 400 units of Mahogany available at the beginning of each week

There are 450 units of labor available during each week

So we can identify the sets and some parameters.

### Sets

The first set I can see in this description is the set of products. We have two different products (chairs and tables) that we need to map with some numbers, so it’s easier to refer to them in a mathematical way:

Similarly, we can define a set for products with the same goal (make it easier to refer to them in a mathematical way):

### Parameters

Remember that this part is known beforehand, so it’s the easy part. From the text, we can identify the revenues per chair and table (45$ and 80$, respectively), and the maximum amount of resources (400 units of mahogany, 450 units of labor).

Since the revenues are related to products and the maximum amount of mahogany and labor are related to resources, we have already defined the sets for resources and products… Let’s use them!

So for revenues, since chairs relate to product 1 and tables relate to product 2, we would have something like:

Similarly, and using the exact same logic, parameters for resources are:

Let’s continue defining parameters. In the next part of the problem definition we had:

🪑 You estimate that:

One chair requires 5 units of mahogany and 10 units of labor

One table requires 20 units of mahogany and 15 units of labor

And we ended up with a picture, remember? Let’s focus on just one part of it, the one that refers to the text above:

See? We have defined a matrix of parameters that takes into account chairs and tables, but also mahogany and labor units.

This parameter is called $a$ and has 2 different indices, the first one indicating the resource (1 for mahogany, 2 for labor), while the second one indicates the product (1 for chairs, 2 for tables).

### Decision variables

In this problem you need to calculate the amount of chairs and tables to produce in the weekly planning, so your decision variables would be…

Exactly.

The number of chairs and tables to produce. So let’s call them x_1 and x_2 to the decision variables that define those amounts for chairs and tables, respectively.

### Objective function

The first question here is: given any amount of chairs and tables sold, how could you calculate the total revenues?

We know the revenues per product (rev_1, rev_2) and the decision variables attached to them (x_1, x_2), so we need to multiply the revenues per product by the number of products:

This is exactly the same as saying:

### Constraints

I’m not going to lie to you: this is usually the trickiest part.

Not only because of the definition itself, but also because sometimes, in businesses, it’s kind of difficult to get all of them right from the beginning. It’s pretty common to see how people that make decisions usually don’t think about a proper definition of them.

However, your job as an Operations Research Engineer is exactly that.

So what would be the constraints in our problem from FurnitORe?

In this problem we can see that:

🪑 (…)

There are 400 units of mahogany available at the beginning of each week

There are 450 units of labor available during each week

Meaning that we can use 400 units of mahogany at most in a given week, as well as 450 units of labor at most in a given week.

It seems we have identified pretty much everything in our problem, right? Let’s see the final mathematical model that defines it 👇🏻

# 🧩 Mathematics behind the Furniture Production Problem

Now that we know:

The basic elements of any optimization problem

How to identify each part in your business problem

What about mixing everything into a mathematical formulation?

I know it sounds difficult, but it’s harder thinking than doing it. So let’s break it down to 3 steps:

### Decision variables

This is the easiest part for this problem. We already defined x_1 and x_2.

As they need to be at least 0, we know they belong to the positive part of the integer numbers. So their domain will go in the range [0, infinity):

### Objective function

We already had a definition:

But let’s get back to math notation. Since we want to maximize that function, let’s do that:

As simple as that.

However, it’s always better to express everything in a more mathematical way of doing it. Having the parameters and decision variables attached to sets, and making use of summations, it’s easy to make the objective function more compact:

### Constraints

We have at least 2 constraints to be properly defined that relate to resources. Let’s break them down.

1) Mahogany capacity constraint

Which says that 5 units of mahogany per chair plus 20 units of mahogany per table cannot exceed 400 units of mahogany in total. This is the same as saying:

Or even better:

2) Labor capacity constraint

This is pretty similar to the previous one, so let’s repeat the process:

Which says that 10 units of labor per chair plus 15 units of labor per table cannot exceed 450 units of labor in total. This is the same as saying:

Or even better:

3) Non-negativity

There is an implicit constraint about the domain of the variables since they go from 0 on, Let’s just make it explicit:

So you have just written your first mathematical model!

Being honest, the last parts of each constraint are not usually done. This was an exercise for you to break the ice with mathematics. You know, getting used to summations and compact forms.

Let’s put it all together then, so the next time you see a mathematical formulation for an optimization problem, you easily recognize everything. This problem, as usually formulated and explicit as possible:

That s.t. that you see there is subject to -the constraints that follow-.

# 🏁 Wrapping up

Wow, that’s been a journey, huh?

You have gone through the end-to-end process of just knowing an informal definition of a problem to a formal definition in mathematical terms:

You started seeing the basic elements of any optimization problem. Remember that there are 5 of them (sets, parameters, decision variables, objective function, and constraints).

Then you were able to identify each of them from the Furniture Production Problem that we already defined yesterday.

Finally, you wrote the mathematical model that defines the problem

Congratulations! This is one of the hardest parts, so if you understand it well, then you are in a good position for the days to come.

# ✍🏻 The exercise

Yesterday I asked you to think about the potential optimization problems at your company.

Now that you are able to translate them into maths, I encourage you to do so!

This is the exercise for today, as it is hard and probably it will take some time.

Reading and writing a mathematical model are completely different tasks, so if you have any issue with that, or need any help, you know I’m here to help you.

In any case, if you couldn’t think of a solution to the Furniture Production Problem yesterday, try it again and let me know if you found any issues with that.

That’s it for today, I hope you enjoyed this third day!

Tomorrow you’ll understand how to solve an optimization problem now that you have a mathematical definition of it. We will see two ways of doing it, but I think one of them will be much more useful to you since it’s completely automated.

See you tomorrow!

Borja.