pub enum LoadCostModel {
LinearCurtailment {
cost_per_mw: f64,
},
QuadraticUtility {
a: f64,
b: f64,
},
PiecewiseLinear {
points: Vec<(f64, f64)>,
},
InterruptPenalty {
cost_per_mw: f64,
},
}Expand description
Cost / benefit model governing the OPF objective contribution.
Variants§
LinearCurtailment
Linear curtailment cost: c * (P_sched - P_served) [$/MWh].
Represents the Value of Lost Load (VOLL) or interruptible contract price.
OPF will curtail when LMP > c (curtailment is cheaper than serving the load).
Objective contribution to minimise: c * (p_sched - P_served).
Gradient d_obj/d_P_served = -c (serving more load reduces curtailment cost).
QuadraticUtility
Quadratic utility / welfare: U(P) = a*P - b*P²/2.
The marginal utility is MU(P) = a - b*P (linear demand curve).
OPF minimises -U(P) (equivalently, maximises utility minus cost).
At equilibrium: MU(P_served) = LMP (price equals marginal value).
OPF objective contribution (to minimise): -(a*P - b*P²/2).
Gradient d_obj/d_P = -(a - b*P) = b*P - a.
Second derivative (for Hessian): b (positive = convex minimisation).
Fields
PiecewiseLinear
Piecewise-linear utility: list of (P_breakpoint_MW, marginal_utility_$/MWh) pairs.
Breakpoints must be sorted by P in ascending order. The utility between adjacent breakpoints is the integral of the linear interpolated MU. Compatible with LP formulation (no quadratic terms).
InterruptPenalty
Fixed penalty for any curtailment (interruptible contract).
Similar to LinearCurtailment but semantically represents a per-event
interrupt payment rather than a value-of-lost-load.
Objective: c * (P_sched - P_served).
Implementations§
Source§impl LoadCostModel
impl LoadCostModel
Sourcepub fn objective_contribution(
&self,
p_served_pu: f64,
p_sched_pu: f64,
base_mva: f64,
) -> f64
pub fn objective_contribution( &self, p_served_pu: f64, p_sched_pu: f64, base_mva: f64, ) -> f64
Evaluate cost contribution to OPF objective (to minimise).
For utility models, returns the negative utility (minimising negative utility maximises social welfare). For cost models, returns the positive curtailment cost.
p_served and p_sched are both in per-unit (positive = consuming).
Returns $/hr (consistent with generator cost units in the OPF).
Sourcepub fn d_obj_d_p(&self, p_served_pu: f64, base_mva: f64) -> f64
pub fn d_obj_d_p(&self, p_served_pu: f64, base_mva: f64) -> f64
Gradient of objective contribution w.r.t. p_served_pu.
Used in gradient evaluation (AC-OPF objective gradient). Units: $/hr / (pu) = $/hr * base_mva / MW.
Sourcepub fn d2_obj_d_p2(&self, base_mva: f64) -> f64
pub fn d2_obj_d_p2(&self, base_mva: f64) -> f64
Second derivative of objective w.r.t. p_served_pu (for Hessian).
Non-zero only for LoadCostModel::QuadraticUtility: b * base_mva².
All other models have zero second derivative (linear in P_served).
Sourcepub fn has_quadratic_term(&self) -> bool
pub fn has_quadratic_term(&self) -> bool
Whether this cost model contributes a nonzero quadratic (Hessian) term.
Sourcepub fn dc_linear_obj_coeff(&self, base_mva: f64) -> f64
pub fn dc_linear_obj_coeff(&self, base_mva: f64) -> f64
Linear objective coefficient for DC-OPF (LP/QP).
For LP-compatible models (LinearCurtailment, InterruptPenalty):
returns -cost_per_mw * base_mva (coefficient on P_served_pu in objective).
For QP models (QuadraticUtility): returns the linear coefficient -a * base_mva.
The quadratic term must be added to the Hessian separately.
For PiecewiseLinear: returns 0.0 (pwl epiograph constraints handle it).
Sourcepub fn dc_quadratic_obj_coeff(&self, base_mva: f64) -> f64
pub fn dc_quadratic_obj_coeff(&self, base_mva: f64) -> f64
Quadratic diagonal coefficient for DC-OPF (QP Hessian).
For LoadCostModel::QuadraticUtility: b * base_mva² (full quadratic coefficient,
HiGHS applies 0.5× internally for the symmetric ½ x’Hx convention).
Trait Implementations§
Source§impl Clone for LoadCostModel
impl Clone for LoadCostModel
Source§fn clone(&self) -> LoadCostModel
fn clone(&self) -> LoadCostModel
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more