def __init__(self, *args, **kw): self.goal = 'min' self.bins = {} #self.objective = '' MatrixProblem.__init__(self, *args, **kw) self.__init_kwargs = kw self._init = True
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs) self.n = self.C.shape[1] # if 'damp' not in kwargs.keys(): kwargs['damp'] = None # if 'X' not in kwargs.keys(): kwargs['X'] = nan*ones(self.n) if self.x0 is None: self.x0 = zeros(self.n)
def __init__(self, *args, **kwargs): self.goal = 'minimum' MatrixProblem.__init__(self, *args, **kwargs) if len(args) > 1 and not hasattr(args[0], 'is_oovar'): self.err( 'No more than 1 argument is allowed for classic style LP constructor' )
def __init__(self, *args, **kwargs): if len(args) > 2: self.err('incorrect args number for LLAVP constructor, must be 0..2 + (optionaly) some kwargs') if len(args) > 0: kwargs['C'] = args[0] if len(args) > 1: kwargs['d'] = args[1] MatrixProblem.__init__(self) llavp_init(self, kwargs)
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs) self.n = self.C.shape[1] # if 'damp' not in kwargs.keys(): kwargs['damp'] = None # if 'X' not in kwargs.keys(): kwargs['X'] = nan*ones(self.n) if self.x0 is None: self.x0 = zeros(self.n)
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs) if self._isFDmodel(): self.x0 = self.C return self.f = asfarray(self.f) self.n = self.f.size # for p.n to be available immediately after assigning prob if self.x0 is None: self.x0 = zeros(self.n)
def __init__(self, *args, **kwargs): self.probType = 'SDP' self.S = {} self.d = {} MatrixProblem.__init__(self, *args, **kwargs) self.f = asfarray(self.f) self.n = self.f.size if self.x0 is None: self.x0 = zeros(self.n)
def __init__(self, *args, **kwargs): if len(args) > 2: self.err( 'incorrect args number for LLAVP constructor, must be 0..2 + (optionaly) some kwargs' ) if len(args) > 0: kwargs['C'] = args[0] if len(args) > 1: kwargs['d'] = args[1] MatrixProblem.__init__(self) llavp_init(self, kwargs)
def __init__(self, *args, **kwargs): self.QC = [] MatrixProblem.__init__(self, *args, **kwargs) if self._isFDmodel(): if len(args) > 1: self.x0 = args[1] self.f = args[0] else: if len(args) > 1 or 'f' in kwargs.keys(): self.f = ravel(self.f)
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs) if len(args) > 1 or 'f' in kwargs.keys(): self.f = ravel(self.f) self.n = self.f.size if len(args) > 0 or 'H' in kwargs.keys(): # TODO: handle sparse cvxopt matrix H unchanges # if not ('cvxopt' in str(type(H)) and 'cvxopt' in p.solver): if not isspmatrix(self.H): self.H = asfarray(self.H, float) # TODO: handle the case in runProbSolver()
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs) if len(args) > 1 or 'f' in kwargs.keys(): self.f = ravel(self.f) self.n = self.f.size if len(args) > 0 or 'H' in kwargs.keys(): # TODO: handle sparse cvxopt matrix H unchanges # if not ('cvxopt' in str(type(H)) and 'cvxopt' in p.solver): if not isspmatrix(self.H): self.H = asfarray( self.H, float) # TODO: handle the case in runProbSolver()
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs) if self.goal == 'all': Name, name = 'all eigenvectors and eigenvalues', 'all' if not isinstance(self.C[0], dict): self.N = self.C.shape[0] else: assert type(self.goal) in (dict, tuple, list) and len(self.goal) == 1, \ 'EIG goal argument should be "all" or Python dict {goal_name: number_of_required_eigenvalues}' if type(self.goal) == dict: goal_name, N = list(self.goal.items())[0] else: goal_name, N = self.goal self.N = N name = ''.join(goal_name.lower().split()) if name in ('lm', 'largestmagnitude'): Name, name = 'largest magnitude', 'le' elif name in ('sm', 'smallestmagnitude'): Name, name = 'smallest magnitude', 'sm' elif name in ('lr', 'largestrealpart'): Name, name = 'largest real part', 'lr' elif name in ('sr', 'smallestrealpart'): Name, name = 'smallest real part', 'sr' elif name in ('li', 'largestimaginarypart'): Name, name = 'largest imaginary part', 'li' elif name in ('si', 'smallestimaginarypart'): Name, name = 'smallest imaginary part', 'si' elif name in ('la', 'largestamplitude'): Name, name = 'largestamplitude', 'la' elif name in ('sa', 'smallestamplitude'): Name, name = 'smallest amplitude', 'sa' elif name in ('be', 'bothendsofthespectrum'): Name, name = 'both ends of the spectrum', 'be' self.goal = Name self._goal = name
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs) if self.goal == 'all': Name, name = 'all eigenvectors and eigenvalues', 'all' if not isinstance(self.C[0], dict): self.N = self.C.shape[0] else: assert type(self.goal) in (dict, tuple, list) and len(self.goal) == 1, \ 'EIG goal argument should be "all" or Python dict {goal_name: number_of_required_eigenvalues}' if type(self.goal) == dict: goal_name, N = list(self.goal.items())[0] else: goal_name, N = self.goal self.N = N name = ''.join(goal_name.lower().split()) if name in ('lm', 'largestmagnitude'): Name, name = 'largest magnitude', 'le' elif name in ('sm', 'smallestmagnitude'): Name, name = 'smallest magnitude', 'sm' elif name in ('lr', 'largestrealpart'): Name, name = 'largest real part', 'lr' elif name in ('sr', 'smallestrealpart'): Name, name = 'smallest real part', 'sr' elif name in ('li', 'largestimaginarypart'): Name, name = 'largest imaginary part', 'li' elif name in ('si', 'smallestimaginarypart'): Name, name = 'smallest imaginary part', 'si' elif name in ('la', 'largestamplitude'): Name, name = 'largestamplitude', 'la' elif name in ('sa', 'smallestamplitude'): Name, name = 'smallest amplitude', 'sa' elif name in ('be', 'bothendsofthespectrum'): Name, name = 'both ends of the spectrum', 'be' self.goal = Name self._goal = name
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs) if 'damp' not in kwargs.keys(): self.damp = None if 'f' not in kwargs.keys(): self.f = None if not self._isFDmodel(): if len(args)>0: self.n = args[0].shape[1] else: self.n = kwargs['C'].shape[1] #self.lb = -inf * ones(self.n) #self.ub = inf * ones(self.n) if not hasattr(self, 'lb'): self.lb = -inf * ones(self.n) if not hasattr(self, 'ub'): self.ub = inf * ones(self.n) if self.x0 is None: self.x0 = zeros(self.n) else: # is FD model if type(self.C) not in (set, tuple, list): if 'is_oovar' not in dir(self.C): s = ''' Icorrect data type for LLSP constructor, first argument should be numpy ndarray, scipy sparse matrix, FuncDesigner oofun or list of oofuns''' self.err(s) self.C = [self.C]
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs) if 'damp' not in kwargs.keys(): self.damp = None if 'f' not in kwargs.keys(): self.f = None if not self._isFDmodel(): if len(args) > 0: self.n = args[0].shape[1] else: self.n = kwargs['C'].shape[1] #self.lb = -inf * ones(self.n) #self.ub = inf * ones(self.n) if not hasattr(self, 'lb'): self.lb = -inf * ones(self.n) if not hasattr(self, 'ub'): self.ub = inf * ones(self.n) if self.x0 is None: self.x0 = zeros(self.n) else: # is FD model if type(self.C) not in (set, tuple, list): if 'is_oovar' not in dir(self.C): s = ''' Icorrect data type for LLSP constructor, first argument should be numpy ndarray, scipy sparse matrix, FuncDesigner oofun or list of oofuns''' self.err(s) self.C = [self.C]
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs)
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs)
def __init__(self, *args, **kw): self.goal = 'max' self.objective = 'weight' MatrixProblem.__init__(self, *args, **kw) self.__init_kwargs = kw self._init = True
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs) self.f = asfarray(self.f) self.n = self.f.size # for p.n to be available immediately after assigning prob if self.x0 is None: self.x0 = zeros(self.n)
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs) self.x0 = zeros(2*len(self.q))
def __init__(self, *args, **kwargs): MatrixProblem.__init__(self, *args, **kwargs) self.x0 = zeros(2 * len(self.q))
def __init__(self, *args, **kw): MatrixProblem.__init__(self, *args, **kw) self.__init_kwargs = kw self._init = True
def __init__(self, *args, **kwargs): self.goal = 'minimum' MatrixProblem.__init__(self, *args, **kwargs) if len(args) > 1 and not hasattr(args[0], 'is_oovar'): self.err('No more than 1 argument is allowed for classic style LP constructor')
def __init__(self, *args, **kw): self.goal = 'max' self.objective = 'weight' MatrixProblem.__init__(self, *args, **kw) self.__init_kwargs = kw self._init = True
def __init__(self, *args, **kw): MatrixProblem.__init__(self, *args, **kw) self.__init_kwargs = kw self._init = True