Example #1
0
def run_DE_on_Ros_ND(CPV_tuple, OFE_budgets, randomSeed):
    X_min, f_best_hist, X_hist, F_hist = DE_opt(objfun=Ros_ND,
                                                x_lb=-5.0 * numpy.ones(prob_d),
                                                x_ub=5.0 * numpy.ones(prob_d),
                                                Np=int(CPV_tuple[0]),
                                                Cr=CPV_tuple[1],
                                                F=CPV_tuple[2],
                                                evals=max(OFE_budgets),
                                                printLevel=0)
    F = numpy.array(f_best_hist)
    OFEs_made = int(CPV_tuple[0]) * numpy.arange(1, len(X_hist) + 1)
    return get_F_vals_at_specified_OFE_budgets(F, OFEs_made, OFE_budgets)
Example #2
0
def run_DE_on_Ros_ND(CPV_tuple, OFE_budgets, randomSeed):
    X_min, f_best_hist, X_hist, F_hist = DE_opt(
        objfun = Ros_ND,
        x_lb = -5.0 * numpy.ones(prob_d),
        x_ub =  5.0 * numpy.ones(prob_d),
        Np = int(CPV_tuple[0]),
        Cr = CPV_tuple[1],
        F = CPV_tuple[2],
        evals = max(OFE_budgets),
        printLevel=0
        )
    F =  numpy.array(f_best_hist)
    OFEs_made = int(CPV_tuple[0])*numpy.arange(1,len(X_hist)+1)
    return  get_F_vals_at_specified_OFE_budgets(F, OFEs_made, OFE_budgets)
Example #3
0
def sphere_ND(CPVs, OFE_budgets, randomSeed):
    anneal_module.fast_sa_run(prob_id=2,
                              x0=-100 + 200 * numpy.random.rand(D),
                              dwell=int(CPVs[0]),
                              m=CPVs[1],
                              maxevals=max(OFE_budgets),
                              random_seed=randomSeed,
                              lower=-100.0 * numpy.ones(D),
                              upper=100.0 * numpy.ones(D),
                              **anneal_KWs)
    return get_F_vals_at_specified_OFE_budgets(
        F=anneal_module.fval_hist.copy(),
        E=anneal_module.eval_hist.copy(),
        E_desired=OFE_budgets)
def sphere_ND(CPVs, OFE_budgets, randomSeed):
    anneal_module.fast_sa_run(
        prob_id=2,
        x0=-100 + 200 * numpy.random.rand(D),
        dwell=int(CPVs[0]),
        m=CPVs[1],
        maxevals=max(OFE_budgets),
        random_seed=randomSeed,
        lower=-100.0 * numpy.ones(D),
        upper=100.0 * numpy.ones(D),
        **anneal_KWs
    )
    return get_F_vals_at_specified_OFE_budgets(
        F=anneal_module.fval_hist.copy(), E=anneal_module.eval_hist.copy(), E_desired=OFE_budgets
    )
def run_simulated_annealing(CPVs, OFE_budgets, randomSeed):
    dwell = int(CPVs[0]) #equibavent to population size in evolutionary algorithms
    func = evaluation_history_recording_wrapper( Ros_ND, dwell, solution_valid )
    optimize.anneal(func, 
                    x0 = -0.5 * numpy.random.rand(5),
                    #x0 = -2.048 + 2*2.048*numpy.random.rand(10), #if used make sure tMOPSO sample size greater than 100
                    m = CPVs[1],
                    T0 = 500.0,
                    lower= -2.048,
                    upper=  2.048,
                    dwell=dwell, 
                    maxeval = max( OFE_budgets ), #termination criteria
                    feps = 0.0, 
                    Tf = 0.0)
    return get_F_vals_at_specified_OFE_budgets(F=func.f_hist, E=func.OFE_hist, E_desired=OFE_budgets)
def anneal(CPVs, OFE_budgets, randomSeed):
    #fast_sa_run - Function signature:
    #  fast_sa_run(prob_id,x0,t0,dwell,m,n,quench,boltzmann,maxevals,lower,upper,random_seed,[d])
    anneal_module.fast_sa_run(prob_id = 1 ,
                              x0 = -2.048 + 2*2.048*numpy.random.rand(D),
                              t0 = 500.0,
                              dwell = int(CPVs[0]),
                              m = CPVs[1],
                              n = 1.0,
                              quench = 1.0,
                              boltzmann = 1.0,
                              maxevals = max(OFE_budgets),
                              lower = -2.048*numpy.ones(D),
                              upper =  2.048*numpy.ones(D),
                              random_seed = randomSeed)
    return get_F_vals_at_specified_OFE_budgets(F=anneal_module.fval_hist.copy(), E=anneal_module.eval_hist.copy(), E_desired=OFE_budgets)
Example #7
0
def anneal(CPVs, OFE_budgets, randomSeed):
    #fast_sa_run - Function signature:
    #  fast_sa_run(prob_id,x0,t0,dwell,m,n,quench,boltzmann,maxevals,lower,upper,random_seed,[d])
    anneal_module.fast_sa_run(prob_id=1,
                              x0=-2.048 + 2 * 2.048 * numpy.random.rand(D),
                              t0=500.0,
                              dwell=int(CPVs[0]),
                              m=CPVs[1],
                              n=1.0,
                              quench=1.0,
                              boltzmann=1.0,
                              maxevals=max(OFE_budgets),
                              lower=-2.048 * numpy.ones(D),
                              upper=2.048 * numpy.ones(D),
                              random_seed=randomSeed)
    return get_F_vals_at_specified_OFE_budgets(
        F=anneal_module.fval_hist.copy(),
        E=anneal_module.eval_hist.copy(),
        E_desired=OFE_budgets)
Example #8
0
def run_simulated_annealing(CPVs, OFE_budgets, randomSeed):
    dwell = int(
        CPVs[0])  #equibavent to population size in evolutionary algorithms
    func = evaluation_history_recording_wrapper(Ros_ND, dwell, solution_valid)
    optimize.anneal(
        func,
        x0=-0.5 * numpy.random.rand(5),
        #x0 = -2.048 + 2*2.048*numpy.random.rand(10), #if used make sure tMOPSO sample size greater than 100
        m=CPVs[1],
        T0=500.0,
        lower=-2.048,
        upper=2.048,
        dwell=dwell,
        maxeval=max(OFE_budgets),  #termination criteria
        feps=0.0,
        Tf=0.0)
    return get_F_vals_at_specified_OFE_budgets(F=func.f_hist,
                                               E=func.OFE_hist,
                                               E_desired=OFE_budgets)
import numpy
from optTune import get_F_vals_at_specified_OFE_budgets

evals_made = numpy.array([5, 10, 15, 20])
solution_error_achieved = numpy.array([0.5, 0.3, 0.2, 0.15])
OFE_budgets = numpy.array([2, 3, 5, 7, 11, 16, 20, 30])
F, E = get_F_vals_at_specified_OFE_budgets(solution_error_achieved, evals_made, OFE_budgets)

print("F : %s" % F)
print("E : %s" % E)
Example #10
0
 def __call__(self, CPV_tuple, OFE_budgets, randomSeed):
     F, OFEs_made = self.batchFun( self.prep_input( CPV_tuple, OFE_budgets, randomSeed))
     F = F - cec_tp_mins[self.prob_id]
     return  get_F_vals_at_specified_OFE_budgets(F, OFEs_made, OFE_budgets)
Example #11
0
 def __call__(self, CPV_tuple, OFE_budgets, randomSeed):
     F, OFEs_made = self.batchFun(
         self.prep_input(CPV_tuple, OFE_budgets, randomSeed))
     F = F - cec_tp_mins[self.prob_id]
     return get_F_vals_at_specified_OFE_budgets(F, OFEs_made, OFE_budgets)
Example #12
0
import numpy
from optTune import get_F_vals_at_specified_OFE_budgets

evals_made = numpy.array([5, 10, 15, 20])
solution_error_achieved = numpy.array([0.5, 0.3, 0.2, 0.15])
OFE_budgets = numpy.array([2, 3, 5, 7, 11, 16, 20, 30])
F, E = get_F_vals_at_specified_OFE_budgets(solution_error_achieved, evals_made,
                                           OFE_budgets)

print('F : %s' % F)
print('E : %s' % E)
Example #13
0
 def sub_fun(F_in,E_in,E_d):
     print('zip(E_in,F_in) %s' %' '.join('%i,%1.2f ' % (e,f) for e,f in zip(E_in,F_in)))
     print('  E_desired %s' % ' '.join(map(str,E_d)))
     F_out, E_out =  get_F_vals_at_specified_OFE_budgets(F_in,E_in,E_d)
     print('  zip(E_out,F_out) %s' %' '.join('%i,%1.2f ' % (e,f) for e,f in zip(E_out,F_out)))