@@ -614,6 +614,8 @@ con : 2 x ∈ [-4.0, -2.0]
614
614
615
615
## Modify a variable coefficient
616
616
617
+ ### Scalar constraints
618
+
617
619
To modify the coefficients for a linear term (modifying the coefficient of a
618
620
quadratic term is not supported) in a constraint, use
619
621
[ ` set_normalized_coefficient ` ] ( @ref ) . To query the current coefficient, use
@@ -635,6 +637,30 @@ julia> normalized_coefficient(con, x[2])
635
637
[ ` set_normalized_coefficient ` ] ( @ref ) sets the coefficient of the normalized
636
638
constraint. See [ Normalization] ( @ref ) for more details.
637
639
640
+ ### Vector constraints
641
+
642
+ To modify the coefficients of a vector-valued constraint, use
643
+ [ ` set_normalized_coefficients ` ] ( @ref ) .
644
+ ``` jldoctest
645
+ julia> model = Model();
646
+
647
+ julia> @variable(model, x)
648
+ x
649
+
650
+ julia> @constraint(model, con, [2x + 3x, 4x] in MOI.Nonnegatives(2))
651
+ con : [5 x, 4 x] ∈ MathOptInterface.Nonnegatives(2)
652
+
653
+ julia> set_normalized_coefficients(con, x, [(1, 3.0)])
654
+
655
+ julia> con
656
+ con : [3 x, 4 x] ∈ MathOptInterface.Nonnegatives(2)
657
+
658
+ julia> set_normalized_coefficients(con, x, [(1, 2.0), (2, 5.0)])
659
+
660
+ julia> con
661
+ con : [2 x, 5 x] ∈ MathOptInterface.Nonnegatives(2)
662
+ ```
663
+
638
664
## Delete a constraint
639
665
640
666
Use [ ` delete ` ] ( @ref ) to delete a constraint from a model. Use [ ` is_valid ` ] ( @ref )
0 commit comments