class LinearOptimizationService method .solve()

LinearOptimizationService is the Apps Script service.

.solve() is the method name you will see after a dot in your code.

What it does

Runs the solver and returns the best solution found.

Why it's used

  • Run the optimizer and get the best feasible plan.
  • Write results back to a sheet for review.

Common errors

  • Forgetting parentheses on solve. Write LinearOptimizationService.solve(), not LinearOptimizationService.solve or solve by itself.
  • Skipping dots between chained calls. Each step needs a dot, like LinearOptimizationService.solve().
  • Adding spaces where they do not belong. Write LinearOptimizationService.solve(), not LinearOptimizationService .solve(), LinearOptimizationService.solve (), or LinearOptimizationService . solve().
  • Wrong capitalization. Use LinearOptimizationService and solve, not linearoptimizationservice or solve.

Explore

Related methods

Better Sheets tutorials

No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.