예제 #1
0
 def __init__(self,name,m,n):
     self.name = name
     
     # Call parent constructor
     cvxpy_expression.__init__(self,m,n)
     
     # No structure
     for i in range(0,m,1):
         for j in range(0,n,1):
             v = cvxpy_scalar_param(name+'['+str(i)+','+str(j)+']')
             self[i,j] = v
예제 #2
0
def param(name=None, m=1, n=1):
    """ 
    Create a parameter.

    :param name: Parameter name.
    :type name: String
    :param m: Rows.
    :param n: Columns.
    :rtype: :class:`cvxpy_param` or :class:`cvxpy_scalar_param`.
    """
    if ((m, n) == (1, 1)):
        return cvxpy_scalar_param(name)
    else:
        return cvxpy_param(name, m, n)
예제 #3
0
def param(name=None,m=1,n=1):
    """ 
    Create a parameter.

    :param name: Parameter name.
    :type name: String
    :param m: Rows.
    :param n: Columns.
    :rtype: :class:`cvxpy_param` or :class:`cvxpy_scalar_param`.
    """
    if((m,n) == (1,1)):
        return cvxpy_scalar_param(name)
    else:
        return cvxpy_param(name,m,n)
예제 #4
0
파일: arrays.py 프로젝트: rubiruchi/sim_rel
    def __init__(self, m, n, attribute=None, name=None):
        """
        Class constructor.

        :param name: String.
        :param m: Number of rows.
        :param n: Number of columns.
        :param attribute: Keyword (See cvxpy.defs).
        """

        # Set name
        if name == None:
            name = BASE_PARAM + str(cvxpy_scalar_param.i)
            cvxpy_scalar_param.i += 1

        # Call parent constructor
        cvxpy_array.__init__(self, m, n)

        # Fill in
        for i in range(0, m, 1):
            for j in range(0, n, 1):
                v = cvxpy_scalar_param(
                    attribute, name + '[' + str(i) + ',' + str(j) + ']')
                self.data[i][j] = v
예제 #5
0
    def __init__(self,m,n,attribute=None,name=None):
        """
        Class constructor.

        :param name: String.
        :param m: Number of rows.
        :param n: Number of columns.
        :param attribute: Keyword (See cvxpy.defs).
        """

        # Set name
        if name == None:
            name = BASE_PARAM+str(cvxpy_scalar_param.i)
            cvxpy_scalar_param.i += 1

        # Call parent constructor
        cvxpy_array.__init__(self,m,n)
        
        # Fill in
        for i in range(0,m,1):
            for j in range(0,n,1):
                v = cvxpy_scalar_param(attribute,
                                       name+'['+str(i)+','+str(j)+']')
                self.data[i][j] = v