Enumeration solvers
OptimalApplication.optimalportfolio_enumerate
— Functionoptimalportfolio_enumerate(mkt::SameCostsMarket) -> X, v
Produce the optimal portfolio for SameCostsMarket
defined by mkt
. Very slow; you probably should use applicationorder_list
or applicationorder_heap
instead.
julia> mkt = SameCostsMarket([0.2, 0.5, 0.1, 0.6, 0.1], [1, 4, 9, 1, 8], 2);
julia> optimalportfolio_enumerate(mkt)
([2, 3], 2.7)
optimalportfolio_enumerate(mkt::VariedCostsMarket) -> X, v
Produce the optimal portfolio for VariedCostsMarket
defined by mkt
. Very slow; you probably should use optimalportfolio_dynamicprogram
or optimalportfolio_branchbound
or optimalportfolio_simulatedannealing
instead.
julia> mkt = VariedCostsMarket([0.2, 0.5, 0.1, 0.6, 0.1], [1, 4, 9, 1, 8], [2, 4, 2, 5, 1], 8);
julia> optimalportfolio_enumerate(mkt)
([2, 5, 3], 3.24)
OptimalApplication.optimalportfolio_branchbound
— Functionoptimalportfolio_branchbound(mkt::VariedCostsMarket; maxit=10000, verbose=false) -> X, v
Use the branch-and-bound algorithm to produce the optimal portfolio for the VariedCostsMarket
defined by mkt
. Intractable for large markets.
julia> mkt = VariedCostsMarket([0.2, 0.5, 0.1, 0.6, 0.1], [1, 4, 9, 1, 8], [2, 4, 2, 5, 1], 8);
julia> optimalportfolio_branchbound(mkt)
([2, 3, 5], 3.24)
OptimalApplication.optimalportfolio_dynamicprogram_slow
— Functionoptimalportfolio_dynamicprogram_slow(mkt, δ) -> X, v
Uses a dynamic program to produce the optimal portfolio X
with valuation v
, for the VariedCostsMarket
defined by mkt
. The valuation of X
differs from that of the global optimum by no more than δ
.
julia> mkt = VariedCostsMarket([0.2, 0.5, 0.1, 0.6, 0.1], [1, 4, 9, 1, 8], [2, 4, 2, 5, 1], 8);
julia> optimalportfolio_dynamicprogram_slow(mkt, 1e-6)
([3, 5, 2], 3.24)
This dynamic program iterates on portfolio valuations and is an "exact" form of the approximation algorithm implemented in this package as optimalportfolio_fptas
. For the vast majority of problem instances, optimalportfolio_dynamicprogram
is a faster way to obtain an exact solution, but this one technically can be used to obtain the global optimum by setting δ = eps()
.