cma_es_lib.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:rllabplusplus 作者: shaneshixiang 项目源码 文件源码
def _set_x0(self, x0):
        if x0 == str(x0):
            x0 = eval(x0)
        self.x0 = array(x0)  # should not have column or row, is just 1-D
        if self.x0.ndim == 2:
            if self.opts.eval('verbose') >= 0:
                _print_warning('input x0 should be a list or 1-D array, trying to flatten ' +
                        str(self.x0.shape) + '-array')
            if self.x0.shape[0] == 1:
                self.x0 = self.x0[0]
            elif self.x0.shape[1] == 1:
                self.x0 = array([x[0] for x in self.x0])
        if self.x0.ndim != 1:
            raise _Error('x0 must be 1-D array')
        if len(self.x0) <= 1:
            raise _Error('optimization in 1-D is not supported (code was never tested)')
        self.x0.resize(self.x0.shape[0])  # 1-D array, not really necessary?!

    # ____________________________________________________________
    # ____________________________________________________________
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号