@@ -19,7 +19,7 @@ function MOI.set(model::LinQuadOptimizer, ::MOI.ObjectiveSense,
1919 unsafe_set! (model, MOI. ObjectiveFunction {Linear} (),
2020 MOI. ScalarAffineFunction (MOI. ScalarAffineTerm{Float64}[],
2121 0.0 ))
22- model. obj_type = AffineObjective
22+ model. obj_type = AFFINE_OBJECTIVE
2323 model. obj_sense = MOI. FEASIBILITY_SENSE
2424 else
2525 throw (MOI. CannotSetAttribute (MOI. ObjectiveSense,
@@ -46,10 +46,10 @@ function MOI.set(model::LinQuadOptimizer,
4646 attribute:: MOI.ObjectiveFunction{MOI.SingleVariable} ,
4747 objective:: MOI.SingleVariable )
4848 __assert_objective__ (model, attribute)
49- if model. obj_type == QuadraticObjective
49+ if model. obj_type == QUADRATIC_OBJECTIVE
5050 set_quadratic_objective! (model, Int[], Int[], Float64[])
5151 end
52- model. obj_type = SingleVariableObjective
52+ model. obj_type = SINGLE_VARIABLE_OBJECTIVE
5353 model. single_obj_var = objective. variable
5454 set_linear_objective! (model, [get_column (model, objective. variable)], [1.0 ])
5555 set_constant_objective! (model, 0.0 )
@@ -68,11 +68,11 @@ Sets a linear objective function without cannonicalizing `objective`.
6868"""
6969function unsafe_set! (model:: LinQuadOptimizer , :: MOI.ObjectiveFunction{F} ,
7070 objective:: Linear ) where F
71- if model. obj_type == QuadraticObjective
71+ if model. obj_type == QUADRATIC_OBJECTIVE
7272 # previous objective was quadratic, so zero quadratic part
7373 set_quadratic_objective! (model, Int[], Int[], Float64[])
7474 end
75- model. obj_type = AffineObjective
75+ model. obj_type = AFFINE_OBJECTIVE
7676 model. single_obj_var = nothing
7777 set_linear_objective! (model,
7878 map (term -> get_column (model, term. variable_index), objective. terms),
8484function MOI. set (model:: LinQuadOptimizer , attribute:: MOI.ObjectiveFunction ,
8585 objective:: Quad )
8686 __assert_objective__ (model, attribute)
87- model. obj_type = QuadraticObjective
87+ model. obj_type = QUADRATIC_OBJECTIVE
8888 model. single_obj_var = nothing
8989 aff_cols, aff_coefs, quad_rows, quad_cols, quad_coefs = canonical_reduction (model, objective)
9090 set_linear_objective! (model, aff_cols, aff_coefs)
@@ -100,20 +100,20 @@ function MOI.supports(model::LinQuadOptimizer, ::MOI.ObjectiveFunction{F}) where
100100end
101101
102102function MOI. get (model:: LinQuadOptimizer , :: MOI.ObjectiveFunctionType )
103- if model. obj_type == SingleVariableObjective
103+ if model. obj_type == SINGLE_VARIABLE_OBJECTIVE
104104 return MOI. SingleVariable
105- elseif model. obj_type == AffineObjective
105+ elseif model. obj_type == AFFINE_OBJECTIVE
106106 return MOI. ScalarAffineFunction{Float64}
107107 else
108- @assert model. obj_type == QuadraticObjective
108+ @assert model. obj_type == QUADRATIC_OBJECTIVE
109109 return MOI. ScalarQuadraticFunction{Float64}
110110 end
111111end
112112
113113function MOI. get (model:: LinQuadOptimizer , :: MOI.ObjectiveFunction{MOI.SingleVariable} )
114- if model. obj_type != SingleVariableObjective
114+ if model. obj_type != SINGLE_VARIABLE_OBJECTIVE
115115 if VERSION >= v " 0.7-"
116- throw (InexactError (:convert , SingleVariableObjective , model. obj_type))
116+ throw (InexactError (:convert , SINGLE_VARIABLE_OBJECTIVE , model. obj_type))
117117 else
118118 throw (InexactError ())
119119 end
@@ -122,9 +122,9 @@ function MOI.get(model::LinQuadOptimizer, ::MOI.ObjectiveFunction{MOI.SingleVari
122122end
123123
124124function MOI. get (model:: LinQuadOptimizer , :: MOI.ObjectiveFunction{Linear} )
125- if model. obj_type == QuadraticObjective
125+ if model. obj_type == QUADRATIC_OBJECTIVE
126126 if VERSION >= v " 0.7-"
127- throw (InexactError (:convert , AffineObjective , model. obj_type))
127+ throw (InexactError (:convert , AFFINE_OBJECTIVE , model. obj_type))
128128 else
129129 throw (InexactError ())
130130 end
@@ -148,7 +148,7 @@ function MOI.get(model::LinQuadOptimizer, ::MOI.ObjectiveFunction{Quad})
148148 variable_coefficients
149149 )
150150 quadratic_terms = MOI. ScalarQuadraticTerm{Float64}[]
151- if model. obj_type == QuadraticObjective
151+ if model. obj_type == QUADRATIC_OBJECTIVE
152152 Q = get_quadratic_terms_objective (model)
153153 rows = rowvals (Q)
154154 coefficients = nonzeros (Q)
@@ -174,15 +174,15 @@ end
174174
175175function MOI. modify (model:: LinQuadOptimizer , :: MOI.ObjectiveFunction{F} ,
176176 change:: MOI.ScalarCoefficientChange{Float64} ) where F<: MOI.AbstractScalarFunction
177- if F <: MOI.ScalarQuadraticFunction && model. obj_type != QuadraticObjective
177+ if F <: MOI.ScalarQuadraticFunction && model. obj_type != QUADRATIC_OBJECTIVE
178178 throw (MOI. UnsupportedObjectiveModification (change,
179179 " ObjectiveFunction is not a ScalarQuadraticFunction." ))
180- elseif F <: MOI.ScalarAffineFunction && model. obj_type != AffineObjective
180+ elseif F <: MOI.ScalarAffineFunction && model. obj_type != AFFINE_OBJECTIVE
181181 throw (MOI. UnsupportedObjectiveModification (change,
182182 " ObjectiveFunction is not a ScalarAffineFunction." ))
183183 end
184- if model. obj_type == SingleVariableObjective
185- model. obj_type = AffineObjective
184+ if model. obj_type == SINGLE_VARIABLE_OBJECTIVE
185+ model. obj_type = AFFINE_OBJECTIVE
186186 model. single_obj_var = nothing
187187 end
188188 change_objective_coefficient! (model, get_column (model, change. variable),
0 commit comments