9cf7514b2e13eba47d78e2965220aabe6804d183,tests/test_efficient_frontier.py,,test_max_sharpe_sector_constraints_manual,#,531

Before Change



    ef = setup_efficient_frontier()
    for sector in sector_upper:
        is_sector = [v == sector for k, v in sector_mapper.items()]
        ef.add_constraint(lambda w: cp.sum(w[is_sector]) <= sector_upper[sector])
    for sector in sector_lower:
        is_sector = [v == sector for k, v in sector_mapper.items()]
        ef.add_constraint(lambda w: cp.sum(w[is_sector]) >= sector_lower[sector])

After Change


        is_sector = [sector_mapper[t] == sector for t in ef.tickers]
        ef.add_constraint(lambda w: cp.sum(w[is_sector]) <= sector_upper[sector])
    for sector in sector_lower:
        is_sector = [sector_mapper[t] == sector for t in ef.tickers]
        ef.add_constraint(lambda w: cp.sum(w[is_sector]) >= sector_lower[sector])

    weights = ef.max_sharpe()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: robertmartin8/PyPortfolioOpt
Commit Name: 9cf7514b2e13eba47d78e2965220aabe6804d183
Time: 2020-06-07
Author: martin.robertandrew@gmail.com
File Name: tests/test_efficient_frontier.py
Class Name:
Method Name: test_max_sharpe_sector_constraints_manual


Project Name: robertmartin8/PyPortfolioOpt
Commit Name: 9cf7514b2e13eba47d78e2965220aabe6804d183
Time: 2020-06-07
Author: martin.robertandrew@gmail.com
File Name: tests/test_efficient_frontier.py
Class Name:
Method Name: test_efficient_risk_sector_constraints_manual


Project Name: rasbt/mlxtend
Commit Name: c9e82bb1ab323d4a79793e47dbdd9204302e36af
Time: 2015-04-06
Author: se.raschka@me.com
File Name: mlxtend/file_io/find.py
Class Name:
Method Name: find_filegroups