30 EOQ Interactive Model
Economic Order Quantity
Explore how demand, ordering cost, and holding cost affect EOQ.
コード
コード
html`
<div class="eoq-formula">
Q* = √(2DS / H)
</div>
<div class="eoq-metrics">
<div class="eoq-metric">
<div class="eoq-number">
${Qstar.toFixed(1)}
</div>
<div class="eoq-label">
Optimal order quantity
</div>
</div>
<div class="eoq-metric">
<div class="eoq-number">
${orderingCost.toFixed(0)}
</div>
<div class="eoq-label">
Ordering cost
</div>
</div>
<div class="eoq-metric">
<div class="eoq-number">
${totalCost.toFixed(0)}
</div>
<div class="eoq-label">
Total relevant cost
</div>
</div>
</div>
`コード
コード
Plot.plot({
height: 400,
x: {
label: "Order quantity Q"
},
y: {
label: "Annual cost",
grid: true
},
marks: [
Plot.line(
costData,
{
x: "Q",
y: "ordering"
}
),
Plot.line(
costData,
{
x: "Q",
y: "holding"
}
),
Plot.line(
costData,
{
x: "Q",
y: "total",
strokeWidth: 3
}
),
Plot.ruleX(
[Qstar]
),
Plot.dot(
[{
Q: Qstar,
cost: totalCost
}],
{
x: "Q",
y: "cost",
r: 6
}
)
]
})