diff --git a/src/bilinear_approximations/no_approx.jl b/src/bilinear_approximations/no_approx.jl index 8a7f100..a6fd81f 100644 --- a/src/bilinear_approximations/no_approx.jl +++ b/src/bilinear_approximations/no_approx.jl @@ -47,3 +47,54 @@ function _add_bilinear_approx!( end return result_expr end + +""" + _add_bilinear_approx!(::NoBilinearApproxConfig, container, C, names, time_steps, xsq, ysq, x_var, y_var, x_bounds, y_bounds, meta) + +Precomputed-form no-op bilinear approximation: returns exact x·y as a QuadExpr. +`xsq` and `ysq` are accepted for signature parity with the precomputed-form +dispatches of `Bin2Config` and `HybSConfig` (so a caller can swap configs +without changing the call site) but are unused here. + +# Arguments +- `::NoBilinearApproxConfig`: no-op configuration (no fields) +- `container::OptimizationContainer`: the optimization container +- `::Type{C}`: component type +- `names::Vector{String}`: component names +- `time_steps::UnitRange{Int}`: time periods +- `xsq`: precomputed x² container (ignored) +- `ysq`: precomputed y² container (ignored) +- `x_var`: container of x variables indexed by (name, t) +- `y_var`: container of y variables indexed by (name, t) +- `x_bounds::Vector{MinMax}`: per-component bounds on x +- `y_bounds::Vector{MinMax}`: per-component bounds on y +- `meta::String`: variable type identifier for the approximation +""" +function _add_bilinear_approx!( + ::NoBilinearApproxConfig, + container::OptimizationContainer, + ::Type{C}, + names::Vector{String}, + time_steps::UnitRange{Int}, + xsq, + ysq, + x_var, + y_var, + x_bounds::Vector{MinMax}, + y_bounds::Vector{MinMax}, + meta::String, +) where {C <: IS.InfrastructureSystemsComponent} + result_expr = add_expression_container!( + container, + BilinearProductExpression, + C, + names, + time_steps; + meta, + expr_type = JuMP.QuadExpr, + ) + for name in names, t in time_steps + result_expr[name, t] = x_var[name, t] * y_var[name, t] + end + return result_expr +end