> ## Documentation Index
> Fetch the complete documentation index at: https://docs.erna.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# minimizeCost

```ts theme={null}
function minimizeCost(opts?): RuleEntry<"minimize-cost", CostRuleOptions>;
```

Tells the solver to minimize total labor cost.

## Parameters

<ResponseField name="opts">
  [`CostRuleOptions`](./CostRuleOptions)
</ResponseField>

## Returns

`RuleEntry`\<`"minimize-cost"`, [`CostRuleOptions`](./CostRuleOptions)>

Without this rule, cost modifiers only affect post-solve calculation.
When present, the solver actively prefers cheaper assignments.

For hourly members, penalizes each assignment proportionally to cost.
For salaried members, adds a fixed weekly salary cost when they have
any assignment that week (zero marginal cost up to contracted hours).

Cost modifiers adjust the calculation:

* `dayMultiplier(factor, opts?)` - multiply base rate on specific days
* `daySurcharge(amount, opts?)` - flat extra per hour on specific days
* `timeSurcharge(amount, window, opts?)` - flat extra per hour during a time window
* `overtimeMultiplier({ after, factor }, opts?)` - weekly overtime multiplier
* `overtimeSurcharge({ after, amount }, opts?)` - weekly overtime surcharge
* `dailyOvertimeMultiplier({ after, factor }, opts?)` - daily overtime multiplier
* `dailyOvertimeSurcharge({ after, amount }, opts?)` - daily overtime surcharge
* `tieredOvertimeMultiplier(tiers, opts?)` - multiple overtime thresholds
