@pytest.mark.parametrize('config', [Test1, Test2])
def test_regret_optimizer(config, main_cubes, cvar_cubes):
    opt = RegretOptimizer(len(assets), len(scenarios), config.prob.as_array(), sum_to_1=True)
    opt.set_bounds(config.lb.as_array(), config.ub.as_array())
    (obj_funcs, constraint_funcs) = ([], [])
    for (i, scenario) in enumerate(scenarios):
        obj_funcs.append(obj_max_returns(main_cubes[i]))
        constraint_funcs.append(cvar_fun(cvar_cubes[i], config.cvar[scenario]))
    opt.set_max_objective(obj_funcs)
    opt.add_inequality_constraint(constraint_funcs)
    opt.optimize()
    assert (scenario_solution_equal_or_better(obj_funcs, opt.solution.scenario_optimal, config.solutions) or regret_is_lower(opt.solution.proportions, config.proportions, opt.solution.scenario_optimal, obj_funcs, config.prob.as_array()))
@pytest.mark.parametrize('config', [Test1, Test2])
def test_regret_optimizer(config, main_cubes, cvar_cubes):
    opt = RegretOptimizer(len(assets), len(scenarios), config.prob.as_array(), sum_to_1=True)
    opt.set_bounds(config.lb.as_array(), config.ub.as_array())
    (obj_funcs, constraint_funcs) = ([], [])
    for (i, scenario) in enumerate(scenarios):
        obj_funcs.append(obj_max_returns(main_cubes[i]))
        constraint_funcs.append(cvar_fun(cvar_cubes[i], config.cvar[scenario]))
    opt.set_max_objective(obj_funcs)
    opt.add_inequality_constraint(constraint_funcs)
    opt.optimize()
    assert (scenario_solution_equal_or_better(obj_funcs, opt.solution.scenario_optimal, config.solutions) or regret_is_lower(opt.solution.proportions, config.proportions, opt.solution.scenario_optimal, obj_funcs, config.prob.as_array()))