jump-dev / PiecewiseLinearOpt.jl

Solve optimization problems containing piecewise linear functions
Other
53 stars 21 forks source link

Error Running runtests.jl #37

Closed amirmm11 closed 1 month ago

amirmm11 commented 4 years ago

I am running julia Version 1.3.1 and I get this error when I run runtests.jl, any help is appreciated.

C:\PiecewiseLinearOpt.jl-master\test>julia runtests.jl ERROR: LoadError: LoadError: LoadError: TypeVar in Vararg length must have bounds Union{} and Any Stacktrace: [1] top-level scope at C:\PiecewiseLinearOpt.jl-master\test\types.jl:8 [2] include at .\boot.jl:328 [inlined] [3] include_relative(::Module, ::String) at .\loading.jl:1105 [4] include at .\Base.jl:31 [inlined] [5] include(::String) at C:\PiecewiseLinearOpt.jl-master\test\PiecewiseLinearOpt.jl:3 [6] top-level scope at C:\PiecewiseLinearOpt.jl-master\test\PiecewiseLinearOpt.jl:13 [7] include at .\boot.jl:328 [inlined] [8] include_relative(::Module, ::String) at .\loading.jl:1105 [9] include(::Module, ::String) at .\Base.jl:31 [10] include(::String) at .\client.jl:424 [11] top-level scope at C:\PiecewiseLinearOpt.jl-master\test\runtests.jl:1 [12] include at .\boot.jl:328 [inlined] [13] include_relative(::Module, ::String) at .\loading.jl:1105 [14] include(::Module, ::String) at .\Base.jl:31 [15] exec_options(::Base.JLOptions) at .\client.jl:287 [16] _start() at .\client.jl:460 in expression starting at C:\PiecewiseLinearOpt.jl-master\test\types.jl:8 in expression starting at C:\PiecewiseLinearOpt.jl-master\test\PiecewiseLinearOpt.jl:13 in expression starting at C:\PiecewiseLinearOpt.jl-master\test\runtests.jl:1

joehuchette commented 4 years ago

Should be fixed by https://github.com/joehuchette/PiecewiseLinearOpt.jl/commit/2a00e51fa1162e071aadd19fd8ae3be862fe9e8b. Let me know if it resolves your issue, and I can tag a new release.

amirmm11 commented 4 years ago

Thanks

Here are my changes to get the code run

types.jl: function PWLFunction{D}(x::Vector{NTuple{D, <: Integer}}, z::Vector, T::Vector{Vector}, meta::Dict) where {D}

runtests.jl: include("../src/PiecewiseLinearOpt.jl") using .PiecewiseLinearOpt.

BTW, you can use a Dictionary in all recursive functions to avoid identical calculation.

odow commented 1 month ago

Closing because this is now fixed.