コード例 #1
0
ファイル: py2_run_opti_IC.py プロジェクト: salimoha/pyDOGS_2
def run_opti():
    current_path = os.path.dirname(
        os.path.abspath(inspect.getfile(inspect.currentframe())))
    # generate the directory
    apts = current_path + "/allpoints"
    if not os.path.exists(apts):
        os.makedirs(apts)
    # create the stop file
    stp = current_path + "allpoints/stop.dat"
    stp_path = Path(stp)
    if not stp_path.is_file():
        stop = 0
        fout = open("allpoints/stop.dat", 'w')
        fout.write(str(stop) + "\n")
        fout.close()

    while stop == 0:

        # DOGS_standalone() will first generate the initial points, then run alpha-DOGS algorithm.
        DOGS_standlone()

        # The "solver_lorenz" function will read from "pts_to_eval" and generate a file named "surr_J_new.dat"
        # containing all information about function evaluation.
        dogs.solver_lorenz()

        # Read stop file
        stop = int(np.loadtxt("allpoints/stop.dat"))
        print('stop = ', stop)
    return
コード例 #2
0
    stp_path = Path(stp)
    if not stp_path.is_file():
        stop = 0
        fout = open("allpoints/stop.dat", 'w')
        fout.write(str(stop) + "\n")
        fout.close()

    while stop == 0:

        # DOGS_standalone() will first generate the initial points, then run alpha-DOGS algorithm.
        DOGS_standlone()

        # The "solver_lorenz" function will read from "pts_to_eval" and generate a file named "surr_J_new.dat"
        # containing all information about function evaluation.
        dogs.solver_lorenz()

        # Read stop file
        stop = int(np.loadtxt("allpoints/stop.dat"))
        print('stop = ', stop)
    return


################################################################################################################
#run_opti()
#DOGS_standlone()

dogs.solver_lorenz()
# Delete the directory of allpoints
#current_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
#shutil.rmtree(current_path + "/allpoints")