Skip to content

TimeProfile addition/subtraction #91

@Zetison

Description

@Zetison

Can support for addition and subtraction for TimeProfile's be added?

One could implement this by

+(a::FixedProfile{T}, b::FixedProfile{T}) where {T} = FixedProfile(a.val + b.val)
function +(a::OperationalProfile{T}, b::OperationalProfile{T}) where {T}
    return OperationalProfile(a.vals .+ b.vals)
end
function +(a::StrategicProfile{T}, b::StrategicProfile{T}) where {T}
    return StrategicProfile(a.vals .+ b.vals)
end
function +(a::ScenarioProfile{T}, b::ScenarioProfile{T}) where {T}
    return ScenarioProfile(a.vals .+ b.vals)
end
function +(a::RepresentativeProfile{T}, b::RepresentativeProfile{T}) where {T}
    return RepresentativeProfile(a.vals .+ b.vals)
end

-(a::TimeProfile{T}, b::TimeProfile{T}) where {T} = a + (-b)

or one could implement length(::TimeProfile) and iterate(::TimeProfile) with the .+ and .- convention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions