File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -510,10 +510,12 @@ end
510510
511511function MOI. modify (
512512 model:: AbstractModel ,
513- obj :: MOI.ObjectiveFunction ,
513+ :: MOI.ObjectiveFunction ,
514514 change:: MOI.AbstractFunctionModification ,
515515)
516- return model. objective = modify_function (model. objective, change)
516+ model. objective = modify_function (model. objective, change)
517+ model. objectiveset = true
518+ return
517519end
518520
519521function MOI. get (:: AbstractModel , :: MOI.ListOfOptimizerAttributesSet )
Original file line number Diff line number Diff line change 331331 @test ! haskey (dest. ext, :my_store )
332332 @test model. ext[:my_store ] == 2
333333end
334+
335+ @testset " Objective set via modify" begin
336+ model = MOIU. Model {Float64} ()
337+ x = MOI. add_variable (model)
338+ attr = MOI. ObjectiveFunction {MOI.ScalarAffineFunction{Float64}} ()
339+ MOI. modify (model, attr, MOI. ScalarCoefficientChange (x, 1.0 ))
340+ @test attr in MOI. get (model, MOI. ListOfModelAttributesSet ())
341+ end
You can’t perform that action at this time.
0 commit comments