def testMinMax(algo):
    if (issubclass(algo, bbo.TopologyOptimizer)
        or algo == allopts.StochasticHillClimber):
        # TODO
        return True

    xa1[0] = 2
    evalx = sf(xa1)

    amax1 = algo(sf, xa1, minimize=False)
    amax2 = algo(sf, xa1)
    amax2.minimize = False
    amax3 = algo()
    amax3.setEvaluator(sf, xa1)
    amax3.minimize = False
    amax4 = algo()
    amax4.minimize = False
    amax4.setEvaluator(sf, xa1)
    for i, amax in enumerate([amax1, amax2, amax3, amax4]):
        assert amax.minimize is False or amax.mustMinimize, 'Max: Attribute not set correctly.' \
                                            + str(amax.minimize) + str(amax.mustMinimize) + str(i)
        x, xv = amax.learn(1)
        assert sf(x) == xv, 'Evaluation does not fit: ' + str((sf(x), xv))
        assert xv >= evalx, 'Evaluation did not increase: ' + str(xv) + ' (init: ' + str(evalx) + ')'

    xa1[0] = 2
    amin1 = algo(sf, xa1, minimize=True)
    amin2 = algo(sf, xa1)
    amin2.minimize = True
    amin3 = algo()
    amin3.setEvaluator(sf, xa1)
    amin3.minimize = True
    amin4 = algo()
    amin4.minimize = True
    amin4.setEvaluator(sf, xa1)
    for i, amin in enumerate([amin1, amin2, amin3, amin4]):
        assert amin.minimize is True or amin.mustMaximize, 'Min: Attribute not set correctly.' \
                                            + str(amin.minimize) + str(amin.mustMaximize) + str(i)
        x, xv = amin.learn(1)
        assert sf(x) == xv, 'Evaluation does not fit: ' + str((sf(x), xv)) + str(i)
        assert xv <= evalx, 'Evaluation did not decrease: ' + str(xv) + ' (init: ' + str(evalx) + ')' + str(i)
        assert ((amin.minimize is not amax.minimize)
                or not (amin._wasOpposed is amax._wasOpposed)), 'Inconsistent flags.'

    return True
Edit an ini file, replacing one or more sections. Returns a dictionary
dataset/ETHPy150Open pybrain/pybrain/pybrain/tests/optimizationtest.py/testMinMax--crossover with--dataset/ETHPy150Open saltstack/salt/salt/modules/ini_manage.py/set_option