Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce AbstractModel #273

Merged
merged 3 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Containers/Containers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import Printf
import Base: <=, setindex!, get, getindex, haskey, keys, values, iterate,
length, lastindex, filter, show, keys, copy, isapprox

# interface.jl
export AbstractModel, AbstractProblem

# nestedenum.jl
export NestedEnum, @nestedenum, @exported_nestedenum

Expand All @@ -25,6 +28,7 @@ export ElemDict,

export getelements, getelement, rows, cols, columns, getrecords

include("interface.jl")
include("nestedenum.jl")
include("solsandbounds.jl")

Expand Down
2 changes: 2 additions & 0 deletions src/Containers/interface.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
abstract type AbstractModel end
abstract type AbstractProblem end
8 changes: 4 additions & 4 deletions src/MathProg/reformulation.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
mutable struct Reformulation <: AbstractFormulation
parent::Union{Nothing, AbstractFormulation} # reference to (pointer to) ancestor: Formulation or Reformulation
master::Union{Nothing, Formulation}
dw_pricing_subprs::Dict{FormId, AbstractFormulation} # vector of Formulation or Reformulation
benders_sep_subprs::Dict{FormId, AbstractFormulation}
dw_pricing_subprs::Dict{FormId, AbstractModel}
benders_sep_subprs::Dict{FormId, AbstractModel}
dw_pricing_sp_lb::Dict{FormId, Id} # Attribute has ambiguous name
dw_pricing_sp_ub::Dict{FormId, Id}
storages::Dict{Type{<:AbstractStorage}, AbstractStorage}
Expand All @@ -19,8 +19,8 @@ Construct a `Reformulation` for problem `prob`.
function Reformulation(prob::AbstractProblem)
return Reformulation(nothing,
nothing,
Dict{FormId, AbstractFormulation}(),
Dict{FormId, AbstractFormulation}(),
Dict{FormId, AbstractModel}(),
Dict{FormId, AbstractModel}(),
Dict{FormId, Int}(),
Dict{FormId, Int}(),
Dict{Type{<:AbstractStorage}, AbstractStorage}())
Expand Down
3 changes: 1 addition & 2 deletions src/MathProg/types.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
abstract type AbstractVarConstr end
abstract type AbstractVarConstrId end
abstract type AbstractState end
abstract type AbstractProblem end
abstract type AstractMoiDef end
abstract type AbstractMembership end
abstract type AbstractVcData end
Expand Down Expand Up @@ -153,7 +152,7 @@ const StorageDict = Dict{Type{<:AbstractStorage}, AbstractStorage}
used by algorithms. A formulation contains one storage
per storage type used by algorithms.
"""
abstract type AbstractFormulation end
abstract type AbstractFormulation <: AbstractModel end

EmptyStorage(form::AbstractFormulation) = EmptyStorage()

Expand Down