@@ -767,118 +767,6 @@ function MOI.ScalarAffineFunction(
767767 return MOI. ScalarAffineFunction (terms, a. constant)
768768end
769769
770- """
771- moi_function(x::AbstractJuMPScalar)
772- moi_function(x::AbstractArray{<:AbstractJuMPScalar})
773-
774- Given a JuMP object `x`, return the MathOptInterface equivalent.
775-
776- See also: [`jump_function`](@ref).
777-
778- ## Example
779-
780- ```jldoctest
781- julia> model = Model();
782-
783- julia> @variable(model, x);
784-
785- julia> f = 2.0 * x + 1.0
786- 2 x + 1
787-
788- julia> moi_function(f)
789- 1.0 + 2.0 MOI.VariableIndex(1)
790- ```
791- """
792- function moi_function end
793-
794- function moi_function (x:: AbstractArray{AbstractJuMPScalar} )
795- return error (
796- """
797- Unable to convert an array of type `::$(typeof (x)) ` to an equivalent function
798- in MathOptInterface because the array has the abstract element type
799- `AbstractJuMPScalar`.
800-
801- To fix this error, convert every element in the array to the same concrete
802- element type.
803-
804- For example, instead of:
805- ```julia
806- model = Model();
807- @variable(model, x);
808- y = AbstractJuMPScalar[x, sin(x)]
809- @objective(model, Min, y)
810- ```
811- do
812- ```julia
813- @objective(model, Min, convert.(NonlinearExpr, y))
814- ```
815- """ ,
816- )
817- end
818-
819- """
820- moi_function_type(::Type{T}) where {T}
821-
822- Given a JuMP object type `T`, return the MathOptInterface equivalent.
823-
824- See also: [`jump_function_type`](@ref).
825-
826- ## Example
827-
828- ```jldoctest
829- julia> moi_function_type(AffExpr)
830- MathOptInterface.ScalarAffineFunction{Float64}
831- ```
832- """
833- function moi_function_type end
834-
835- """
836- jump_function(model::AbstractModel, x::MOI.AbstractFunction)
837-
838- Given an MathOptInterface object `x`, return the JuMP equivalent.
839-
840- See also: [`moi_function`](@ref).
841-
842- ## Example
843-
844- ```jldoctest
845- julia> model = Model();
846-
847- julia> @variable(model, x);
848-
849- julia> f = 2.0 * index(x) + 1.0
850- 1.0 + 2.0 MOI.VariableIndex(1)
851-
852- julia> jump_function(model, f)
853- 2 x + 1
854- ```
855- """
856- function jump_function end
857-
858- """
859- jump_function_type(model::AbstractModel, ::Type{T}) where {T}
860-
861- Given an MathOptInterface object type `T`, return the JuMP equivalent.
862-
863- See also: [`moi_function_type`](@ref).
864-
865- ## Example
866-
867- ```jldoctest
868- julia> model = Model();
869-
870- julia> jump_function_type(model, MOI.ScalarAffineFunction{Float64})
871- AffExpr (alias for GenericAffExpr{Float64, GenericVariableRef{Float64}})
872- ```
873- """
874- function jump_function_type end
875-
876- moi_function (a:: GenericAffExpr ) = MOI. ScalarAffineFunction (a)
877-
878- function moi_function_type (:: Type{<:GenericAffExpr{T}} ) where {T}
879- return MOI. ScalarAffineFunction{T}
880- end
881-
882770function GenericAffExpr {C,GenericVariableRef{T}} (
883771 m:: GenericModel{T} ,
884772 f:: MOI.ScalarAffineFunction ,
@@ -894,50 +782,6 @@ function GenericAffExpr{C,GenericVariableRef{T}}(
894782 return aff
895783end
896784
897- function jump_function_type (
898- :: GenericModel{T} ,
899- :: Type{MOI.ScalarAffineFunction{C}} ,
900- ) where {C,T}
901- S = promote_type (C, T)
902- return GenericAffExpr{S,GenericVariableRef{T}}
903- end
904-
905- function jump_function (
906- model:: GenericModel{T} ,
907- f:: MOI.ScalarAffineFunction{C} ,
908- ) where {C,T}
909- S = promote_type (C, T)
910- return GenericAffExpr {S,GenericVariableRef{T}} (model, f)
911- end
912-
913- function jump_function_type (
914- :: GenericModel{T} ,
915- :: Type{MOI.VectorAffineFunction{C}} ,
916- ) where {C,T}
917- S = promote_type (C, T)
918- return Vector{GenericAffExpr{S,GenericVariableRef{T}}}
919- end
920-
921- function jump_function (
922- model:: GenericModel{T} ,
923- f:: MOI.VectorAffineFunction{C} ,
924- ) where {T,C}
925- S = promote_type (C, T)
926- ret = GenericAffExpr{S,GenericVariableRef{T}}[]
927- for scalar_f in MOIU. eachscalar (f)
928- g = GenericAffExpr {S,GenericVariableRef{T}} (scalar_f. constant)
929- for t in scalar_f. terms
930- add_to_expression! (
931- g,
932- t. coefficient,
933- GenericVariableRef (model, t. variable),
934- )
935- end
936- push! (ret, g)
937- end
938- return ret
939- end
940-
941785"""
942786 _fill_vaf!(
943787 terms::Vector{<:MOI.VectorAffineTerm},
@@ -984,12 +828,6 @@ function MOI.VectorAffineFunction(
984828 return MOI. VectorAffineFunction (terms, constant)
985829end
986830
987- moi_function (a:: Vector{<:GenericAffExpr} ) = MOI. VectorAffineFunction (a)
988-
989- function moi_function_type (:: Type{<:Vector{<:GenericAffExpr{T}}} ) where {T}
990- return MOI. VectorAffineFunction{T}
991- end
992-
993831"""
994832 _eval_as_variable(f::F, x::GenericAffExpr, args...) where {F}
995833
0 commit comments