Creates a solver for a linear optimization problem.
class LinearOptimizationService method .createEngine()
LinearOptimizationService is the Apps Script service.
.createEngine() is the method name you will see after a dot in your code.
What it does
Why it's used
- Set up a solver for staffing, shipping, or budget problems.
- Find the best mix under real constraints.
Common errors
- Forgetting parentheses on createEngine. Write LinearOptimizationService.createEngine(), not LinearOptimizationService.createEngine or createEngine by itself.
- Skipping dots between chained calls. Each step needs a dot, like LinearOptimizationService.createEngine().
- Adding spaces where they do not belong. Write LinearOptimizationService.createEngine(), not LinearOptimizationService .createEngine(), LinearOptimizationService.createEngine (), or LinearOptimizationService . createEngine().
- Wrong capitalization. Use LinearOptimizationService and createEngine, not linearoptimizationservice or createengine.
Explore
Related methods
-
.solve()
Runs the solver and returns the best solution found.
-
.addConstraint()
Adds a rule the solution must satisfy.
-
.addVariable()
Adds a decision variable to the optimization model.
More Apps Script
Better Sheets tutorials
No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.