Skip to content

Commit

Permalink
rm param variables
Browse files Browse the repository at this point in the history
  • Loading branch information
stelmo committed Aug 11, 2024
1 parent bc4f7d4 commit 6c47113
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 2 additions & 0 deletions docs/src/1-parametric-models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,5 @@ pr14 = ParameterLinearValue([1,2], [2,3]) * ConstraintTrees.LinearValue([1,2], [
@test all(pr14.idxs .== [(1, 1), (1,2),(2, 2)]) && all(pr14.weights .== [Num(2), Num(7),Num(6)]) #src
pr15 = ConstraintTrees.LinearValue([1,2], [1,2]) - ParameterQuadraticValue([(1, 1)], [2,]) #src
@test all(pr15.idxs .== [(0,1),(1, 1), (0, 2)]) && all(pr15.weights .== [Num(1), Num(-2),Num(2)]) #src

@test ConstraintTrees.substitute(ParameterQuadraticValue([(0,0), (1,1),], [1,2]), [Num(1),Num(2)]) == 3
11 changes: 0 additions & 11 deletions src/constraint_trees.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ limitations under the License.
Extend various functions in ConstraintTrees to work with their Parameter based equivalents.
=#

ConstraintTrees.incr_var_idxs(x::ParameterLinearValue, incr::Int) = ParameterLinearValue(
idxs = ConstraintTrees.incr_var_idx.(x.idxs, incr),
weights = x.weights,
)

ConstraintTrees.incr_var_idxs(x::ParameterQuadraticValue, incr::Int) =
ParameterQuadraticValue(
idxs = broadcast(ii -> ConstraintTrees.incr_var_idx.(ii, incr), x.idxs),
weights = x.weights,
)

ConstraintTrees.var_count(x::ParameterLinearValue) = isempty(x.idxs) ? 0 : last(x.idxs)

ConstraintTrees.var_count(x::ParameterQuadraticValue) =
Expand Down

0 comments on commit 6c47113

Please sign in to comment.