File tree Expand file tree Collapse file tree 2 files changed +3
-6
lines changed
Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change 8989function simplify! (f:: MOI.ScalarQuadraticFunction{T} ) where {T}
9090 f = MOI. Utilities. canonicalize! (f)
9191 if isempty (f. quadratic_terms)
92- if isempty (f. affine_terms)
93- return f. constant
94- end
95- return MOI. ScalarAffineFunction (f. affine_terms, f. constant)
92+ return simplify! (MOI. ScalarAffineFunction (f. affine_terms, f. constant))
9693 end
9794 return f
9895end
Original file line number Diff line number Diff line change @@ -46,8 +46,8 @@ function test_derivative()
4646 # derivative(f::MOI.ScalarQuadraticFunction{T}, x::MOI.VariableIndex)
4747 convert (MOI. ScalarQuadraticFunction{Float64}, 1.0 * x)=> 1.0 ,
4848 convert (MOI. ScalarQuadraticFunction{Float64}, 1.0 * x + 0.0 * y)=> 1.0 ,
49- 1.0 * x* y=> 1.0 * y,
50- 1.0 * y* x=> 1.0 * y,
49+ 1.0 * x* y=> y,
50+ 1.0 * y* x=> y,
5151 1.0 * x* x=> 2.0 * x,
5252 1.0 * x* x+ 3.0 * x+ 4.0 => 2.0 * x+ 3.0 ,
5353 2.0 * x* x- 2.0 * x+ 1.0 => 4.0 * x- 2.0 ,
You can’t perform that action at this time.
0 commit comments