2016-08-31 01:37:53 +00:00
|
|
|
# TODO: change the input approach
|
|
|
|
immutable ModelInput
|
2016-10-25 16:57:20 +00:00
|
|
|
n::Int
|
2016-08-31 01:37:53 +00:00
|
|
|
end
|
|
|
|
|
2016-10-25 16:57:20 +00:00
|
|
|
isinput(x) = isa(x, Constant) && isa(x.value, ModelInput)
|
2016-08-31 01:37:53 +00:00
|
|
|
|
2016-10-25 16:57:20 +00:00
|
|
|
bumpinput(i::ModelInput) = ModelInput(i.n + 1)
|
2016-08-31 01:37:53 +00:00
|
|
|
bumpinput(x) = x
|
|
|
|
|
|
|
|
bumpinputs(v::IVertex) = mapconst(bumpinput, v)
|
|
|
|
|
|
|
|
function spliceinputs(v::IVertex, inputs::IVertex...)
|
|
|
|
postwalk(v) do v
|
|
|
|
isinput(value(v)) ?
|
2016-10-25 16:57:20 +00:00
|
|
|
inputs[value(v).value.n] :
|
2016-08-31 01:37:53 +00:00
|
|
|
v
|
|
|
|
end
|
|
|
|
end
|