added hidden API for opt_method

This commit is contained in:
robertmartin8
2020-01-20 20:46:35 +00:00
parent 7dd8661d35
commit bad3c0cf7d
2 changed files with 8 additions and 5 deletions

View File

@@ -107,6 +107,7 @@ class BaseScipyOptimizer(BaseOptimizer):
- ``bounds`` - float tuple OR (float tuple) list
- ``initial_guess`` - np.ndarray
- ``constraints`` - dict list
- ``opt_method`` - the optimisation algorithm to use. Defaults to SLSQP.
"""
def __init__(self, n_assets, tickers=None, weight_bounds=(0, 1)):
@@ -121,6 +122,7 @@ class BaseScipyOptimizer(BaseOptimizer):
# Optimisation parameters
self.initial_guess = np.array([1 / self.n_assets] * self.n_assets)
self.constraints = [{"type": "eq", "fun": lambda x: np.sum(x) - 1}]
self.opt_method = "SLSQP"
def _make_valid_bounds(self, test_bounds):
"""