QC#
API path: power_flow_relaxations.models.qc
- class QC(
- scenario,
- configuration,
- degree=8,
- seed=42,
- local_sampling=True,
- eps_V=0.1,
- eps_theta=0.15,
- custom_envelope_bounds=None,
- **kwargs,
Bases:
JabrImplementation of QC relaxation for ACOPF using CVXPY.
Initialize Jabr relaxation variables on top of the base nodal model.
- Parameters:
scenario – Unit-based scenario (network, bids, periods).
configuration – Solver configuration object.
**kwargs – Extra options forwarded to
NodalBaseModel.
Notes
Creates per-period dense matrices c_vwt and s_vwt of shape [n_nodes, n_nodes] used in relaxed AC flow equations.
- cos_envelope(t, x, xL, xU)[source]#
Add convex relaxation bounds for the nonlinear term t = cos(x).
Uses a quadratic-cone-supported upper bound and a chord lower bound over [xL, xU] to approximate the cosine graph.
- global_qmc_envelope_bounds()[source]#
Compute bounds on theta_v - theta_w, sin(theta_v - theta_w), cos(theta_v - theta_w) by sampling voltage magnitudes and angles, then filtering based on thermal limits.
- Returns:
delta_theta_min, delta_theta_max, sin_min, sin_max, cos_min, cos_max
- Return type:
arrays [N, N]
- local_qmc_envelope_bounds(jabr_allocation, eps_V, eps_theta)[source]#
Compute per-edge bounds on theta_v - theta_w, sin(theta_v - theta_w), cos(theta_v - theta_w) by sampling around the Jabr solution with Sobol sequences, filtering based on thermal limits. Adaptive theta perturbation is applied per edge.
- mccormick_envelope(t, x, y, xL, xU, yL, yU)[source]#
Add McCormick envelope constraints for the bilinear term t = x * y.
Uses variable bounds (xL, xU) and (yL, yU) to add the four linear inequalities that define the convex hull relaxation.
- power_constraints()[source]#
Add Jabr SOCP power-flow constraints for every period and branch.
Includes: - active/reactive flow consistency with (c_vw, s_vw) terms, - cone constraints coupling diagonal and off-diagonal voltage products, - symmetry/skew-symmetry structure (c = c^T, s = -s^T), - voltage magnitude bounds on diagonal entries of c.
Finally delegates thermal current limits to
NodalBaseModel.current_rating_constraints().
- sin_envelope(t, x, xL, xU)[source]#
Add convex relaxation bounds for the nonlinear term t = sin(x).
Builds tangent/chord-based bounds over [xL, xU] to approximate the sine graph with linear constraints.
- solve(**kwargs)[source]#
Solve the relaxation and return an allocation-like result object.
- Parameters:
results_file – Optional CSV path for raw variable dumps (or failure status).
stats_file – Optional path for computed run statistics.
u_fixed – Optional fixed commitments to enforce during solve.
min_vol – Objective mode flag for zonal-tracking formulations.
zonal_allocation – Optional target allocation for redispatch-style tracking objective.
verbose – Enable MOSEK solver logs and build-step prints.
force_integrality – If relaxed commitments produce fractional values, rerun once with rounded binary commitments fixed.
**kwargs – Reserved for compatibility.
- Returns:
Allocation-like object on success; lightweight error object otherwise.
- Return type: