Public
Edited
Jun 22, 2024
Paused
13 stars
Insert cell
Insert cell
Insert cell
Insert cell
arablePlanting = mip()
.objective(Math.max, "50x + 120y")
.subjectTo("100x + 200y <= 10000")
.subjectTo("10x + 30y <= 1200")
.subjectTo("x + y <= 110")
.solve()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
buttonsAndZips = mip()
.objective(Math.max, "x + y")
.subjectTo("50x + 24y <= 2400")
.subjectTo("30x + 33y <= 2100")
.subjectTo("x >= 45")
.subjectTo("y >= 5")
.solve()
Insert cell
Insert cell
Insert cell
lp3 = mip()
.objective(Math.max, "a + b + 2c - 2d")
.subjectTo("a + 2c <= 100")
.subjectTo("2b - 8d <= 0")
.subjectTo("b - 2c + d >= 1")
.subjectTo("a + b + c + d == 10")
.solve()
Insert cell
Insert cell
Insert cell
Insert cell
mip3 = mip()
.objective(Math.max, "a + b + 2c - 2d")
.subjectTo("a + 2c <= 100")
.subjectTo("2b - 8d <= 0")
.subjectTo("b - 2c + d >= 1")
.subjectTo("a + b + c + d == 10")
.var("a", BigInt)
.var("b", BigInt)
.var("c", BigInt)
.var("d", BigInt)
.solve()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mip3a = {
return (
mip()
// Minimise cost of allocation
.objective(
Math.min,
"1.25x0 + 0.25x1 + 1.25x2 + x4 + x5 + 1.09x6 + 1.49x7 + 0.09x8"
)
// Point must be allocated to one cell in grid:
.subjectTo("x0+x1+x2 == 1")
.subjectTo("x3+x4+x5 == 1")
.subjectTo("x6+x7+x8 == 1")

// Grid cell can have at most one point allocated to it
.subjectTo("x0+x3+x6 <= 1")
.subjectTo("x1+x4+x7 <= 1")
.subjectTo("x2+x5+x8 <= 1")

.var("x0", Boolean)
.var("x1", Boolean)
.var("x2", Boolean)
.var("x3", Boolean)
.var("x4", Boolean)
.var("x5", Boolean)
.var("x6", Boolean)
.var("x7", Boolean)
.var("x8", Boolean)

.solve()
);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more