As mentioned in the title, I want to use multiple-dispatch to assign different behaviors of the same struct, distinguished by Symbol. The struct can be constructed as follows:
struct AbstractAlgorithm
algorithmName::String
algorithmSymbol::Symbol
function AbstractAlgorithm(algorithmName::String)
if algorithmName ∉ ("Value Iteration", "Policy Iteration")
error("Given algorithm $algorithmName not defined yet.")
elseif algorithmName=="Value Iteration"
new(algorithmName, Symbol("vIter"))
elseif algorithmName=="Policy Iteration"
new(algorithmName, Symbol("pIter"))
end
end
end
And I wanted to distinguish the same struct using different symbols in a function, such as:
function A(a::AbstractAlgorithm with Symbol vIter) = do A1
function A(a::AbstractAlgorithm with Symbol pIter) = do A2
How should I design function A using multiple-dispatch?