Skip to content

Commit

Permalink
Add VehicleType for vehicle routing problems
Browse files Browse the repository at this point in the history
  • Loading branch information
SupplyChef committed Mar 26, 2024
1 parent 80957a7 commit 71c0b12
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
16 changes: 16 additions & 0 deletions src/Product.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
A product in the supply chain.
"""
struct Product
name::String

zones::Array{Float64, 1}

function Product(name, zones=[1.0])
return new(name, zones)
end
end

Base.:(==)(x::Product, y::Product) = x.name == y.name
Base.hash(x::Product, h::UInt64) = hash(x.name, h)
Base.show(io::IO, x::Product) = print(io, x.name)
15 changes: 3 additions & 12 deletions src/SupplyChainModeling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export Plant

export Transport
export Lane
export VehicleType

export add_product!
export add_demand!
Expand Down Expand Up @@ -46,18 +47,8 @@ abstract type Node end

abstract type Transport end

struct Product
name::String

function Product(name)
return new(name)
end
end

Base.:(==)(x::Product, y::Product) = x.name == y.name
Base.hash(x::Product, h::UInt64) = hash(x.name, h)
Base.show(io::IO, x::Product) = print(io, x.name)

include("VehicleType.jl")
include("Product.jl")
include("Location.jl")
include("Customer.jl")
include("Demand.jl")
Expand Down
12 changes: 12 additions & 0 deletions src/VehicleType.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
struct VehicleType
name::String
count::Int64

fixed_cost::Float64
maximum_capacity::Array{Float64, 1}
maximum_time::Float64

function VehicleType(name, count; maximum_capacity=[Inf], maximum_time=Inf, fixed_cost=0.0)
return new(name, count, fixed_cost, maximum_capacity, maximum_time)
end
end

0 comments on commit 71c0b12

Please sign in to comment.