# Objective

PowerModels includes support for cost functions provided as either univariate polynomials or piecewise linear functions. These functions are encoded in the generator and dcline components following the conventions of the Matpower data format. The implementation of the piecewise linear cost functions uses an auxiliary variable implementation often referred to as the $\lambda$ formulation. Additional information about this formulation and why it is used can be found in this technical report.

The objective functions that include the term `fuel_and_flow`

capture cost functions on both generator and dcline components, while the names only including the term `fuel`

work exclusively on generator components and ignore any cost data relating to dcline components.

`PowerModels.calc_pwl_points`

— Methodcleans up raw pwl cost points in preparation for building a mathamatical model.

The key mathematical properties,

- the first and last points are strictly outside of the pmin-to-pmax range
- pmin and pmax occur in the first and last line segments.

`PowerModels.expression_p_dc_cost`

— Methodadds p*dc*cost variables and constraints

`PowerModels.expression_pg_cost`

— Methodadds pg_cost variables and constraints

`PowerModels.objective_min_fuel_and_flow_cost`

— Method`PowerModels.objective_min_fuel_cost`

— Method