コード例 #1
0
    def update_sample(self, mobo_info, n_kb=5, n_cpu=1):
        """Run multi-objective optimization/update.

        Args:
            mobo_info (dict): KADAL-style input dictionary.
            n_kb (int, optional): Requested number of Kriging Believer
                samples to search for. Defaults to 5.
            n_cpu (int, optional): If > 1, uses parallel processing, if
                supported. Defaults to 1.
        """
        # infeasiblesamp = np.where(self.cldat <= 0.15)[0]
        mobo = MOBO(mobo_info, self.obj_krig, autoupdate=False,
                    multiupdate=n_kb, savedata=False,
                    expconst=self.con_krig, chpconst=self.h)
        start_update = time.time()
        xupdate, yupdate, supdate, metricall = mobo.run(disp=True,
                                                        infeasible=None,
                                                        n_cpu=n_cpu)
        elapsed = time.time() - start_update
        print(f'Total update time: {elapsed:.2f} seconds')
        self.total_update_time = elapsed
        self.xupdate.append(xupdate)
        self.yupdate.append(yupdate)
        self.supdate.append(supdate)
        self.metricall.append(metricall)
        return xupdate, yupdate, supdate, metricall
コード例 #2
0
def optimize(kriglist, expconstlist):
    moboInfo = dict()
    moboInfo['nup'] = 5
    moboInfo['acquifunc'] = "ehvi"
    moboInfo['acquifuncopt'] = "diff_evo"
    cheapconstlist = [cheap_const]
    mobo = MOBO(moboInfo, kriglist, autoupdate=True, multiupdate=5, expconst=expconstlist,
                chpconst = cheapconstlist)
    xupdate, yupdate, supdate, metricall = mobo.run(disp=True)
    return xupdate, yupdate, supdate, metricall
コード例 #3
0
ファイル: MOBOdemo.py プロジェクト: jomorlier/KADAL
def runopt(krigobj1, krigobj2):
    moboInfo = dict()
    moboInfo["nup"] = 3
    moboInfo["nrestart"] = 10
    moboInfo["acquifunc"] = "ehvi"
    moboInfo["acquifuncopt"] = "lbfgsb"

    Optim = MOBO(moboInfo,[krigobj1,krigobj2],autoupdate=True,multiupdate=5)
    xupdate,yupdate,supdate,metricall = Optim.run(disp=True)

    return xupdate,yupdate,metricall