Julia-将0.7转换为1.2.0时的继承问题
我一直在尝试转换一些用0.7编写的Julia代码:Julia-将0.7转换为1.2.0时的继承问题,julia,Julia,我一直在尝试转换一些用0.7编写的Julia代码: type SCA <: DiscreteMDP nStates::Int64 nActions::Int64 actions::Vector{Symbol} grid::RectangleGrid function SCA() grid = RectangleGrid(Ranges, Thetas, Bearings, Speeds, Speeds,Responses, Responses) return new(NSta
type SCA <: DiscreteMDP
nStates::Int64
nActions::Int64
actions::Vector{Symbol}
grid::RectangleGrid
function SCA()
grid = RectangleGrid(Ranges, Thetas, Bearings, Speeds, Speeds,Responses, Responses)
return new(NStates, NActions, Actions, grid)
end # function SCA
end # type SCA
我不知道从这里向何处发展,有什么想法吗?谢谢 我看不到这里的继承问题。但是,您必须向我们提供完整的说明以帮助您。您能否发布一个在v0.7中对您有效的完整示例,以及您在v1.2中尝试的内容?对于初学者,您需要在v1.2代码中使用网格插值
,因为这就是矩形网格的所在。这样,您的代码运行良好,但您的内部构造函数不起作用,因为您引用的变量(范围、θ、方向、速度等)不在代码中,因此无法进一步帮助您。我看不到继承问题。但是,您必须向我们提供完整的说明以帮助您。您能否发布一个在v0.7中对您有效的完整示例,以及您在v1.2中尝试的内容?对于初学者,您需要在v1.2代码中使用网格插值,因为这就是矩形网格的所在。这样,代码运行良好,但内部构造函数不起作用,因为您引用的变量(范围、θ、方向、速度等)不在代码中,因此无法进一步帮助您。
mutable struct SCA <: MDP{Int64,Vector{Symbol}}#Something is wrong here
nStates::Int64
nActions::Int64
actions::Vector{Symbol}
grid::RectangleGrid
function SCA()
grid = RectangleGrid(Ranges, Thetas, Bearings, Speeds, Speeds, Responses, Responses)
return new{Int64,Int64,Vector{Symbol},RectangleGrid}(NStates, NActions, Actions, grid)#Probably something Wrong here
#Creating a new SCA does not know that MDP is a superclass. Inheritance isnt working
end # function SCA
end # type SCA
"""
MDP{S,A}
Abstract base type for a fully observable Markov decision process.
S: state type
A: action type
"""
abstract type MDP{S,A} end