File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -962,6 +962,7 @@ The following utilities are available for functions:
962
962
Utilities.eval_variables
963
963
Utilities.map_indices
964
964
Utilities.substitute_variables
965
+ Utilities.filter_variables
965
966
Utilities.remove_variable
966
967
Utilities.all_coefficients
967
968
Utilities.unsafe_add
Original file line number Diff line number Diff line change @@ -663,6 +663,11 @@ Return a new function `f` with the variable vi removed.
663
663
function remove_variable (f:: MOI.AbstractFunction , vi:: MOI.VariableIndex )
664
664
return filter_variables (v -> v != vi, f)
665
665
end
666
+ function remove_variable (f:: MOI.AbstractFunction , vis:: Vector{MOI.VariableIndex} )
667
+ # Create a `Set` to test membership in `vis` in O(1).
668
+ set = Set (vis)
669
+ return filter_variables (vi -> ! (vi in set), f)
670
+ end
666
671
667
672
"""
668
673
modify_function(f::AbstractFunction, change::AbstractFunctionModification)
You can’t perform that action at this time.
0 commit comments