@@ -37,7 +37,7 @@ type LinearDynamicLinearCostSPmodel <: SPModel
3737 dynamics:: Function
3838 noises:: Vector{NoiseLaw}
3939
40- finalCost:: PolyhedralFunction
40+ finalCost
4141
4242 function LinearDynamicLinearCostSPmodel (nstage, ubounds, x0, cost, dynamic, aleas, Vfinal= nothing )
4343
@@ -47,10 +47,10 @@ type LinearDynamicLinearCostSPmodel <: SPModel
4747
4848 # First step: process terminal costs.
4949 # If not specified, default value is null function
50- if isa (Vfinal, Void)
51- Vf = PolyhedralFunction (zeros (1 ), zeros (1 , dimStates), 1 )
52- else
50+ if isa (Vfinal, Function) || isa (Vfinal, PolyhedralFunction)
5351 Vf = Vfinal
52+ else
53+ Vf = PolyhedralFunction (zeros (1 ), zeros (1 , dimStates), 1 )
5454 end
5555
5656 xbounds = []
@@ -79,17 +79,17 @@ type PiecewiseLinearCostSPmodel <: SPModel
7979 costFunctions:: Vector{Function}
8080 dynamics:: Function
8181 noises:: Vector{NoiseLaw}
82- finalCost:: PolyhedralFunction
82+ finalCost
8383
8484 function PiecewiseLinearCostSPmodel (nstage, ubounds, x0, costs, dynamic, aleas, Vfinal= nothing )
8585 dimStates = length (x0)
8686 dimControls = length (ubounds)
8787 dimNoises = length (aleas[1 ]. support[:, 1 ])
8888
89- if isa (Vfinal, Void)
90- Vf = PolyhedralFunction (zeros (1 ), zeros (1 , dimStates), 1 )
91- else
89+ if isa (Vfinal, Function) || isa (Vfinal, PolyhedralFunction)
9290 Vf = Vfinal
91+ else
92+ Vf = PolyhedralFunction (zeros (1 ), zeros (1 , dimStates), 1 )
9393 end
9494
9595 xbounds = []
0 commit comments