100 Exercises / Mathematical modeling / Mathematical Modeling 100 Exercises
Allocating Limited Equipment, Staff, and Budget
Define and solve production, staffing, routing, and investment models in SciPy. Compare continuous, integer, and binary decisions and check feasibility.
Optimization Models for a Precision Parts Factory: No.081–No.090
We define production quantities, equipment activation, inspector shifts, delivery routes, and improvement investments as decision variables. We use SciPy to solve linear, integer, and binary-choice models, then explain the resulting operating plan and its limitations.
About this material These notebooks were adapted from corporate training delivered by Surikobo or its representative, Hiroshi Wayama, and published with the participating companies’ permission. All data is fictional and does not describe actual companies or factories.
Introduction: Practical Challenges in Manufacturing Covered in This Article
In a fictional precision parts factory, products A, B, and C share common equipment, personnel, and materials. Capacity cannot meet all demand, so we must choose which products to make and in what quantities. We also assign inspectors by weekday, plan customer delivery routes, and allocate a budget to digital improvement projects.
Optimization is not magic that automatically gives the right answer. This is decision support that involves agreeing on variables, evaluation criteria, and conditions to be met, and confirming whether the resulting solution is feasible on site.
Common situations on site
- The target products and evaluation criteria for ‘making as much as possible’ are ambiguous
- Meeting equipment schedules but overlooking material and personnel constraints
- Producing fractional production numbers or 0.4 people is an unfeasible solution
- Fixed setup costs incurred whenever a product is made are incorrectly treated as proportional costs.
- Shift management, delivery, and investment decisions are made solely based on the experience of the person in charge
- Only the optimal value is reported, with no constraints or alternatives presented.
Why is this issue so difficult to judge?
Multiple products compete for common resources, leading to trade-offs in profit, delivery time, and fairness. The model optimizes only the objectives we specify and guarantees only the conditions included as constraints.
We adjust continuous variables, integer variables, and binary variables to fit the nature of the work, and check the impact and constraints when the solution changes slightly.
Exercises in this article
| No. | Theme | Factory Judgment |
|---|---|---|
| 081 | decision variable | What the model decides |
| 082 | objective function | What to maximize or minimize |
| 083 | Constraint | What must be protected? |
| 084 | linear programming | How to allocate production volume by product |
| 085 | integer variable | Handling count and number of people as integers |
| 086 | binary variable | Decide whether to produce each product |
| 087 | Shift | Meeting the required number of people by day of the week |
| 088 | Delivery | Minimize the delivery-route distance |
| 089 | budget allocation | Select improvement projects |
| 090 | Result translation | Turning the optimal solution into execution instructions |
Preparing the Python environment
Run the cells from top to bottom in Jupyter Notebook. [IN: n] marks an input and [OUT: n] its corresponding output. Environment details show the original execution example; version and OS strings will differ on your machine.
No external data is used. We use SciPy’s linprog and milp, NumPy, pandas, and matplotlib.
Show environment setup
%matplotlib inline
%config InlineBackend.figure_format = 'svg'
import itertools, platform, sys
import matplotlib, matplotlib.pyplot as plt
from matplotlib import font_manager
import numpy as np, pandas as pd, scipy
from scipy.optimize import linprog, milp, Bounds, LinearConstraint
from IPython.display import display
SEED = 42
rng = np.random.default_rng(SEED)
fonts = {f.name for f in font_manager.fontManager.ttflist}
plot_font = next(
(f for f in ["Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP"] if f in fonts),
"sans-serif",
)
plt.rcParams["font.family"] = plot_font
plt.rcParams["axes.unicode_minus"] = False
print(
f"Python {sys.version.split()[0]} / NumPy {np.__version__} / pandas {pd.__version__} / SciPy {scipy.__version__}"
)
print(
f"matplotlib {matplotlib.__version__} / font {plot_font} / seed {SEED} / {platform.platform()}"
)
# Show full text in table cells instead of truncating long descriptions.
pd.set_option("display.max_colwidth", None)
Python 3.13.1 / NumPy 2.5.1 / pandas 3.0.3 / SciPy 1.18.0
matplotlib 3.11.0 / font Hiragino Sans / seed 42 / macOS-26.3-arm64-arm-64bit-Mach-O
Fictional data
Define contribution margin, equipment time, labor time, material requirements, demand limits, minimum supply, and fixed setup costs for three products. Weekly capacity is 6,000 equipment-minutes, 3,300 labor-minutes, and 2,250 kg of material.
Show fictional-data setup
# These data-generation settings are teaching assumptions, not estimates from a real factory.
products = pd.DataFrame(
{
"product": ["A", "B", "C"],
"margin": [1800, 2700, 4400],
"machine_min": [4, 7, 12],
"labor_min": [2, 4, 6],
"material_kg": [1.2, 1.8, 3.2],
"demand_max": [800, 520, 280],
"minimum_supply": [400, 250, 120],
"setup_cost": [180000, 260000, 420000],
}
)
capacities = {"machine_min": 6000, "labor_min": 3300, "material_kg": 2250}
display(products.style.format({"margin": "¥{:,.0f}", "setup_cost": "¥{:,.0f}"}))
print("Weekly capacities:", capacities)
| product | margin | machine_min | labor_min | material_kg | demand_max | minimum_supply | setup_cost | |
|---|---|---|---|---|---|---|---|---|
| 0 | A | ¥1,800 | 4 | 2 | 1.200000 | 800 | 400 | ¥180,000 |
| 1 | B | ¥2,700 | 7 | 4 | 1.800000 | 520 | 250 | ¥260,000 |
| 2 | C | ¥4,400 | 12 | 6 | 3.200000 | 280 | 120 | ¥420,000 |
Weekly capacities: {'machine_min': 6000, 'labor_min': 3300, 'material_kg': 2250}
full = products.copy()
for resource in capacities:
full[resource + "_use"] = full[resource] * full["demand_max"]
resource_table = pd.DataFrame(
{
"Resources": list(capacities),
"Total usage when needed": [full[r + "_use"].sum() for r in capacities],
"Ability": list(capacities.values()),
}
)
resource_table["load factor"] = (
resource_table["Total usage when needed"] / resource_table["Ability"]
)
display(resource_table.style.format({"load factor": "{:.1%}"}))
fig, ax = plt.subplots()
ax.bar(
resource_table["Resources"], resource_table["load factor"] * 100, color="#de2d26"
)
ax.axhline(100, color="black", linestyle="--", label="Ability Ceiling")
ax.set_title("Resource load when producing all demand")
ax.set_xlabel("Resources")
ax.set_ylabel("Resource load (%)")
ax.grid(True, axis="y", alpha=0.3)
ax.legend()
plt.tight_layout()
plt.show()
| Resources | Total usage when needed | Ability | load factor | |
|---|---|---|---|---|
| 0 | machine_min | 10200.000000 | 6000 | 170.0% |
| 1 | labor_min | 5360.000000 | 3300 | 162.4% |
| 2 | material_kg | 2792.000000 | 2250 | 124.1% |
No.081: Defining Decision Variables
Practical context
Decision variables are values that the model can select. Define production volume, number of people, and whether the project is launched, as the range within which the person in charge can change.
Modeling approach
is the weekly production volume of product , and . Clearly indicate the unit, time granularity, and the distinction between continuous and integer numbers.
Check with Python
variables = pd.DataFrame(
{
"variable": ["x_A", "x_B", "x_C"],
"Meaning": [
"ProductsAProduction volume",
"ProductsBProduction volume",
"ProductsCProduction volume",
],
"Unit": ["units/week"] * 3,
"lower limit": products["minimum_supply"],
"upper limit": products["demand_max"],
"type": ["continuous (later intigmatized)"] * 3,
}
)
display(variables)
candidate = np.array([600, 400, 200])
check = products[["machine_min", "labor_min", "material_kg"]].T @ candidate
print(
"Candidate Plan",
dict(zip(products["product"], candidate)),
"Resource Use",
check.to_dict(),
)
| variable | Meaning | Unit | lower limit | upper limit | type | |
|---|---|---|---|---|---|---|
| 0 | x_A | ProductsAProduction volume | units/week | 400 | 800 | continuous (later intigmatized) |
| 1 | x_B | ProductsBProduction volume | units/week | 250 | 520 | continuous (later intigmatized) |
| 2 | x_C | ProductsCProduction volume | units/week | 120 | 280 | continuous (later intigmatized) |
Candidate Plan {'A': np.int64(600), 'B': np.int64(400), 'C': np.int64(200)} Resource Use {'machine_min': 7600.0, 'labor_min': 4000.0, 'material_kg': 2080.0}
Interpreting the results
The variable table allows you to separate the range determined by the model from the parameters input by the field. The minimum supply is not a variable, but a constraint.
No.082: Defining the Objective Function
Practical context
The objective function converts the desirability of a candidate into a single measure. This time, we will maximize the weekly marginal profit.
Modeling approach
. To ensure quality, delivery time, and fairness are not ignored, necessary conditions are included as constraints and penalties.
Check with Python
candidates = pd.DataFrame(
{
"case": ["Avalue", "balance", "Cvalue"],
"A": [750, 600, 450],
"B": [300, 400, 450],
"C": [130, 180, 250],
}
)
candidates["Contribution margin"] = (
candidates[["A", "B", "C"]].to_numpy() @ products["margin"].to_numpy()
)
display(candidates.style.format({"Contribution margin": "¥{:,.0f}"}))
fig, ax = plt.subplots()
ax.bar(candidates["case"], candidates["Contribution margin"] / 1e6, color="#2c7fb8")
ax.set_title("Objective function values of candidate plans")
ax.set_xlabel("Alternative proposal")
ax.set_ylabel("Weekly Marginal Profit (million yen)")
ax.grid(True, axis="y", alpha=0.3)
plt.tight_layout()
plt.show()
| case | A | B | C | Contribution margin | |
|---|---|---|---|---|---|
| 0 | Avalue | 750 | 300 | 130 | ¥2,732,000 |
| 1 | balance | 600 | 400 | 180 | ¥2,952,000 |
| 2 | Cvalue | 450 | 450 | 250 | ¥3,125,000 |
Interpreting the results
Even if the profit is high, if it violates restrictions, it cannot be selected. Check the objective function and executability separately.
No.083: Defining Constraints
Practical context
Express equipment, labor, material, demand, and minimum-supply requirements as constraints to exclude infeasible plans.
Modeling approach
,. Align units and distinguish between hard constraints and mitigable targets.
Check with Python
A = products[["machine_min", "labor_min", "material_kg"]].T.to_numpy()
b = np.array(list(capacities.values()))
rows = []
for _, row in candidates.iterrows():
x = row[["A", "B", "C"]].to_numpy(dtype=float)
use = A @ x
rows.append(
{
"case": row["case"],
"Facility capacity": b[0] - use[0],
"work capacity": b[1] - use[1],
"Material Availability": b[2] - use[2],
"executable": bool(
np.all(use <= b)
and np.all(x >= products["minimum_supply"].to_numpy())
and np.all(x <= products["demand_max"].to_numpy())
),
}
)
feasibility = pd.DataFrame(rows)
display(
feasibility.style.format(
{
"Facility capacity": "{:+,.0f}",
"work capacity": "{:+,.0f}",
"Material Availability": "{:+,.0f}",
}
)
)
| case | Facility capacity | work capacity | Material Availability | executable | |
|---|---|---|---|---|---|
| 0 | Avalue | -660 | -180 | +394 | False |
| 1 | balance | -1,360 | -580 | +234 | False |
| 2 | Cvalue | -1,950 | -900 | +100 | False |
Interpreting the results
Negative slack indicates a constraint violation. Slack by resource shows what additional capacity would be needed to make a candidate plan feasible.
No.084: Formulating as a Linear Programming Problem
Practical context
With linear profits and resource constraints, linear programming enables rapid optimal production allocation.
Modeling approach
SciPy’s linprog minimizes the objective supplied to it. Negate the profit coefficients to maximize profit, and set demand limits and minimum supply as variable bounds.
Check with Python
margin = products["margin"].to_numpy()
bounds = list(zip(products["minimum_supply"], products["demand_max"]))
lp = linprog(-margin, A_ub=A, b_ub=b, bounds=bounds, method="highs")
if not lp.success:
raise RuntimeError(lp.message)
lp_plan = pd.DataFrame(
{
"Products": products["product"],
"Production volume": lp.x,
"Requirement ceiling": products["demand_max"],
}
)
display(
lp_plan.style.format(
{"Production volume": "{:,.1f}", "Requirement ceiling": "{:,.0f}"}
)
)
print(f"Maximum weekly contribution margin: ¥{-lp.fun:,.0f}")
fig, ax = plt.subplots()
x = np.arange(3)
ax.bar(
x - 0.2,
lp_plan["Requirement ceiling"],
0.4,
label="Requirement ceiling",
color="#bdbdbd",
)
ax.bar(
x + 0.2, lp_plan["Production volume"], 0.4, label="optimal amount", color="#2ca25f"
)
ax.set_xticks(x, lp_plan["Products"])
ax.set_title("Production quantities from linear programming")
ax.set_xlabel("Products")
ax.set_ylabel("Production quantity (units/week)")
ax.grid(True, axis="y", alpha=0.3)
ax.legend()
plt.tight_layout()
plt.show()
| Products | Production volume | Requirement ceiling | |
|---|---|---|---|
| 0 | A | 702.5 | 800 |
| 1 | B | 250.0 | 520 |
| 2 | C | 120.0 | 280 |
Maximum weekly contribution margin: ¥2,467,500
Interpreting the results
This allocation is based on a combination of marginal profit and resource consumption. Continuous variables can produce fractional quantities. Use integer variables when actual units or lots cannot be divided.
No.085: Representing Product Quantities and Staffing with Integer Variables
Practical context
The number of products, number of pallets, and number of people are integers. Solve with integer programming so you don’t break constraints with simple rounding.
Modeling approach
and pass the same objective and constraint to the mixed integer program.
Check with Python
integer = milp(
c=-margin,
integrality=np.ones(3),
bounds=Bounds(products["minimum_supply"], products["demand_max"]),
constraints=LinearConstraint(A, -np.inf, b),
)
if not integer.success:
raise RuntimeError(integer.message)
integer_plan = pd.DataFrame(
{
"Products": products["product"],
"continuous solution": lp.x,
"integer solution": integer.x,
}
)
display(
integer_plan.style.format(
{"continuous solution": "{:.2f}", "integer solution": "{:.0f}"}
)
)
print(
f"Integer-plan contribution margin: ¥{-integer.fun:,.0f} / Gap from continuous optimum: ¥{-lp.fun - -integer.fun:,.0f}"
)
| Products | continuous solution | integer solution | |
|---|---|---|---|
| 0 | A | 702.50 | 702 |
| 1 | B | 250.00 | 250 |
| 2 | C | 120.00 | 120 |
Integer-plan contribution margin: ¥2,466,600 / Gap from continuous optimum: ¥900
Interpreting the results
The integer solution gives whole-number quantities. Its objective value may be lower than the continuous optimum because the feasible set is smaller. For batch production, define variables as numbers of lots.
No.086: Expressing Choices Using Binary Variables
Practical context
When a product is manufactured and a fixed setup fee is incurred, the startup status is expressed as 0/1.
Modeling approach
and force when the product is not activated (). Deduct setup cost from the objective. This example removes minimum-supply requirements to allow product selection. Contractual minimum supplies must remain constraints in an operational model.
Check with Python
M = products["demand_max"].to_numpy()
fixed = products["setup_cost"].to_numpy()
c_bin = np.r_[-margin, fixed]
A_res = np.c_[A, np.zeros((3, 3))]
A_link = np.c_[np.eye(3), -np.diag(M)]
A_bin = np.vstack([A_res, A_link])
ub = np.r_[b, np.zeros(3)]
binary = milp(
c=c_bin,
integrality=np.ones(6),
bounds=Bounds(np.zeros(6), np.r_[M, np.ones(3)]),
constraints=LinearConstraint(A_bin, -np.inf, ub),
)
if not binary.success:
raise RuntimeError(binary.message)
binary_plan = pd.DataFrame(
{
"Products": products["product"],
"Production volume": binary.x[:3],
"Startup": binary.x[3:].round().astype(int),
"fixed cost": fixed,
}
)
display(
binary_plan.style.format({"Production volume": "{:,.0f}", "fixed cost": "¥{:,.0f}"})
)
print(f"Profit after deducting fixed costs: ¥{-binary.fun:,.0f}")
| Products | Production volume | Startup | fixed cost | |
|---|---|---|---|---|
| 0 | A | 800 | 1 | ¥180,000 |
| 1 | B | 400 | 1 | ¥260,000 |
| 2 | C | 0 | 0 | ¥420,000 |
Profit after deducting fixed costs: ¥2,080,000
Interpreting the results
For products with high fixed costs, it may be advantageous not to start them up rather than for small-batch production. Big-M uses reasonably small values, such as demand ceilings.
No.087: Formulating the Shift Creation Problem
Practical context
To meet the required number of employees for each day of the week, inspectors are assigned to the five-day consecutive work pattern.
Modeling approach
Use an integer variable for the number of people assigned to each pattern. Minimize the total headcount while ensuring coverage is at least the required number on every day.
Check with Python
days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
coverage = np.zeros((7, 7), int)
for start in range(7):
for k in range(5):
coverage[(start + k) % 7, start] = 1
required = np.array([8, 9, 10, 10, 9, 6, 5])
shift = milp(
c=np.ones(7),
integrality=np.ones(7),
bounds=Bounds(np.zeros(7), np.full(7, np.inf)),
constraints=LinearConstraint(coverage, required, np.inf),
)
if not shift.success:
raise RuntimeError(shift.message)
assigned = np.rint(shift.x).astype(int)
actual = coverage @ assigned
shift_table = pd.DataFrame(
{
"day of the week": days,
"required number of people": required,
"Number of Personnel": actual,
"surplus": actual - required,
}
)
display(shift_table)
fig, ax = plt.subplots()
x = np.arange(7)
ax.bar(x - 0.2, required, 0.4, label="necessary", color="#bdbdbd")
ax.bar(x + 0.2, actual, 0.4, label="configuration", color="#2c7fb8")
ax.set_xticks(x, days)
ax.set_title("Required number of people and optimal placement by day of the week")
ax.set_xlabel("day of the week")
ax.set_ylabel("Number of Inspectors (persons)")
ax.grid(True, axis="y", alpha=0.3)
ax.legend()
plt.tight_layout()
plt.show()
print(
f"Total inspectors required: {assigned.sum()} / Inspectors by work pattern: {assigned.tolist()}"
)
| day of the week | required number of people | Number of Personnel | surplus | |
|---|---|---|---|---|
| 0 | Mon | 8 | 8 | 0 |
| 1 | Tue | 9 | 9 | 0 |
| 2 | Wed | 10 | 10 | 0 |
| 3 | Thu | 10 | 10 | 0 |
| 4 | Fri | 9 | 9 | 0 |
| 5 | Sat | 6 | 6 | 0 |
| 6 | Sun | 5 | 8 | 3 |
Total inspectors required: 12 / Inspectors by work pattern: [3, 1, 3, 0, 2, 0, 3]
Interpreting the results
This is an integer arrangement that meets the required number of people on all days. Adding desired days off, skills, number of night shifts, and fairness results in a practical shift.
No.088: Formulating the Delivery Planning Problem
Practical context
The distance changes depending on the order in which you visit multiple customers from the factory. List all the small-scale examples and find the shortest route.
Modeling approach
This is a traveling-salesperson problem starting and ending at the factory. Coordinates are in kilometers, and distances are Euclidean. With five customers and one factory, we compare visiting orders. Real routing requires road distances or travel times.
Check with Python
locations = pd.DataFrame(
{
"name": [
"Factory",
"customerA",
"customerB",
"customerC",
"customerD",
"customerE",
],
"x": [0, 2, 5, 6, 3, 1],
"y": [0, 6, 5, 1, 2, 3],
}
)
xy = locations[["x", "y"]].to_numpy()
dist = np.linalg.norm(xy[:, None, :] - xy[None, :, :], axis=2)
routes = []
for perm in itertools.permutations(range(1, 6)):
route = (0,) + perm + (0,)
routes.append((sum(dist[route[i], route[i + 1]] for i in range(6)), route))
best_distance, best_route = min(routes)
names = [locations.iloc[i]["name"] for i in best_route]
print(f"Shortest distance: {best_distance:.2f} km / Route: {' → '.join(names)}")
fig, ax = plt.subplots()
route_xy = xy[list(best_route)]
ax.plot(route_xy[:, 0], route_xy[:, 1], marker="o")
for _, r in locations.iterrows():
ax.annotate(r["name"], (r["x"], r["y"]), xytext=(4, 4), textcoords="offset points")
ax.set_title("The shortest route for customer delivery")
ax.set_xlabel("East–west distance (km)")
ax.set_ylabel("North–south distance (km)")
ax.grid(True, alpha=0.3)
plt.tight_layout()
plt.show()
Shortest distance: 20.38 km / Route: Factory → customerD → customerC → customerB → customerA → customerE → Factory
Interpreting the results
On a small scale, you can list them all, but increasing the number of points causes combinations to surge. When adding vehicle capacity, time windows, or multiple vehicles, use dedicated solvers or approximate methods.
No.089: Formulating the Budget Allocation Problem
Practical context
Select improvement projects using their costs, required labor, and expected benefits, subject to budget and staffing limits.
Modeling approach
Let indicate whether project is selected. Maximize subject to budget and labor limits: a binary knapsack model with two resource constraints.
Check with Python
projects = pd.DataFrame(
{
"Case": [
"Predictive maintenance",
"Automated Inspection",
"Shortening the setup process",
"Demand forecasting",
"Warehouse Automation",
"Educational Infrastructure",
],
"Fees_million yen": [22, 30, 14, 12, 28, 8],
"man-hours_person month": [5, 7, 4, 3, 6, 2],
"Expected Effects_million yen": [38, 48, 25, 22, 39, 13],
}
)
A_proj = projects[["Fees_million yen", "man-hours_person month"]].T.to_numpy()
budget = milp(
c=-projects["Expected Effects_million yen"],
integrality=np.ones(len(projects)),
bounds=Bounds(np.zeros(len(projects)), np.ones(len(projects))),
constraints=LinearConstraint(A_proj, -np.inf, [60, 15]),
)
if not budget.success:
raise RuntimeError(budget.message)
projects["Adoption"] = np.rint(budget.x).astype(int)
display(projects)
selected = projects.query("`Adoption`==1")
print(
f"Selected projects: {', '.join(selected['Case'])} / Cost: {selected['Fees_million yen'].sum()} million yen / Expected benefit: {selected['Expected Effects_million yen'].sum()} million yen"
)
fig, ax = plt.subplots()
colors = np.where(projects["Adoption"] == 1, "#2ca25f", "#bdbdbd")
ax.scatter(
projects["Fees_million yen"],
projects["Expected Effects_million yen"],
s=120,
c=colors,
)
for _, r in projects.iterrows():
ax.annotate(
r["Case"],
(r["Fees_million yen"], r["Expected Effects_million yen"]),
xytext=(4, 4),
textcoords="offset points",
)
ax.set_title("Costs, expected effects, and selection results of improvement projects")
ax.set_xlabel("Investment Costs (million yen)")
ax.set_ylabel("Expected Effect (million yen)")
ax.grid(True, alpha=0.3)
plt.tight_layout()
plt.show()
| Case | Fees_million yen | man-hours_person month | Expected Effects_million yen | Adoption | |
|---|---|---|---|---|---|
| 0 | Predictive maintenance | 22 | 5 | 38 | 1 |
| 1 | Automated Inspection | 30 | 7 | 48 | 1 |
| 2 | Shortening the setup process | 14 | 4 | 25 | 0 |
| 3 | Demand forecasting | 12 | 3 | 22 | 0 |
| 4 | Warehouse Automation | 28 | 6 | 39 | 0 |
| 5 | Educational Infrastructure | 8 | 2 | 13 | 1 |
Selected projects: Predictive maintenance, Automated Inspection, Educational Infrastructure / Cost: 60 million yen / Expected benefit: 99 million yen
Interpreting the results
It’s not just a simple cost-effectiveness ratio, but a combination that meets both budget and labor at the same time. Also account for project dependencies, risk, and strategically required projects.
No.090: Translating the results of optimization models into business decisions
Practical context
Only when optimal values are translated into production instructions, constraints, personnel, delivery, investment, and precautions can they be executed.
Modeling approach
Summarize the solution, objective value, constraint utilization, capacity, assumptions, and alternatives in a decision table. Confirm sensitivity and site constraints.
Check with Python
xopt = integer.x
uses = A @ xopt
decision_summary = pd.DataFrame(
{
"Decision-making": [
"ProductsA/B/CProduction",
"inspector",
"Delivery",
"Improved Investment",
],
"Recommendation": [
f"{xopt[0]:.0f}/{xopt[1]:.0f}/{xopt[2]:.0f} units",
f"{assigned.sum()} inspectors",
"→".join(names),
", ".join(selected["Case"]),
],
"confirmation item": [
f"Equipment{uses[0]/b[0]:.1%}・Work{uses[1]/b[1]:.1%}・Ingredients{uses[2]/b[2]:.1%}",
"Preferred Days Off & Skill Restrictions",
"Time window and load capacity",
"Uncertainty of effectiveness and project dependence",
],
}
)
display(decision_summary)
resource_use = pd.DataFrame(
{
"Resources": ["Equipment", "Labor", "Materials"],
"usage amount": uses,
"Ability": b,
}
)
resource_use["usage rate"] = resource_use["usage amount"] / resource_use["Ability"]
fig, ax = plt.subplots()
ax.bar(resource_use["Resources"], resource_use["usage rate"] * 100, color="#756bb1")
ax.axhline(100, color="black", linestyle="--")
ax.set_title("Resource Utilization Rate in Optimal Production Planning")
ax.set_xlabel("Resources")
ax.set_ylabel("Resource utilization (%)")
ax.grid(True, axis="y", alpha=0.3)
plt.tight_layout()
plt.show()
bottleneck = resource_use.loc[resource_use["usage rate"].idxmax()]
print(
f"Most constrained resource: {bottleneck['Resources']} ({bottleneck['usage rate']:.1%})"
)
| Decision-making | Recommendation | confirmation item | |
|---|---|---|---|
| 0 | ProductsA/B/CProduction | 702/250/120 units | Equipment100.0%・Work94.7%・Ingredients74.5% |
| 1 | inspector | 12 inspectors | Preferred Days Off & Skill Restrictions |
| 2 | Delivery | Factory→customerD→customerC→customerB→customerA→customerE→Factory | Time window and load capacity |
| 3 | Improved Investment | Predictive maintenance, Automated Inspection, Educational Infrastructure | Uncertainty of effectiveness and project dependence |
Most constrained resource: Equipment (100.0%)
Interpreting the results
It shows not only production volume but also bottlenecks and unreflected conditions. Without directly giving instructions on the optimal solution, we conduct on-site reviews of rounding, setup order, quality, delivery time, and sensitivity to changed assumptions.
Practical lessons
In optimization, the definition of decision variables, objective functions, and constraints determines the outcome. Continuous, integer, and binary variables can be chosen to match each decision, and shifts, deliveries, and investments can be handled within the same framework. It is important to present not only optimal values but also constraints, assumptions, alternatives, and sensitivities.
Preparing for practical use
1. Decide on the decision-making cycle and units
Align time periods and units, including days, weeks, individual items, lots, and people.
2. Distinguish between hard constraints and goals
We consider imposing restrictions on safety, laws, and contracts, and penalties on preferred delivery deadlines.
3. Manage parameter bases
Assign owners and update schedules for capacity, labor requirements, contribution margins, demand limits, and fixed costs.
4. Compare with current plans in parallel
Evaluate not only profits but also the number of changes, overtime, delivery times, and on-site load.
5. Define what to do when no feasible solution exists
Define which constraints to relax and who approves.
6. Convert the results to executable format
We provide production instructions, shift schedules, delivery sequences, and investment project lists to the site.
Conclusion
No.081–090 represent production volume, startup, shift, delivery, and investment as optimization models. The value of mathematical optimization lies not only in achieving maximum values but also in making trade-offs with resource competition visible and enabling comparison of actionable decisions.
Support for businesses
At Surikobo, we support production planning, workforce shifts, delivery, equipment allocation, and investment allocation with mathematical optimization PoCs and operational design.
📩 Contact Us: www.surikobo.co.jp/contact Please feel free to consult us first.