8.4.1. Attribute Accessor

Collection of APIs to access attributes.

Functions

MDOgetattrinfo()

Retrieve attribute information by its name

MDOgetintattr()

Retrieve an integer-valued attribute by its name

MDOsetintattr()

Set an integer-valued attribute by its name

MDOgetintattrelement()

Retrieve an integer-valued attribute by its name and index

MDOsetintattrelement()

Set element in an integer-valued array attribute by its name and index

MDOgetintattrarray()

Retrieve the values of an integer-valued array attribute by its name and range

MDOsetintattrarray()

Set the values of an integer-valued array attribute by its name and range

MDOgetintattrlist()

Retrieve the values of an integer-valued array attribute by its name and indices

MDOsetintattrlist()

Set the values of an integer-valued array attribute by its name and indices

MDOgetdblattr()

Retrieve a double-valued attribute by its name

MDOsetdblattr()

Set a double-valued attribute by its name

MDOgetdblattrelement()

Retrieve a double-valued attribute by its name and index

MDOsetdblattrelement()

Set element in a double-valued array attribute by its name and index

MDOgetdblattrarray()

Retrieve the values of a double-valued array attribute by its name and range

MDOsetdblattrarray()

Set the values of a double-valued array attribute by its name and range

MDOgetdblattrlist()

Retrieve the values of a double-valued array attribute by its name and indices

MDOsetdblattrlist()

Set the values of a double-valued array attribute by its name and indices

MDOgetcharattrelement()

Retrieve a char-valued attribute by its name and index

MDOsetcharattrelement()

Set element in a char-valued array attribute by its name and index

MDOgetcharattrarray()

Retrieve the values of a char-valued array attribute by its name and range

MDOsetcharattrarray()

Set the values of a char-valued array attribute by its name and range

MDOgetcharattrlist()

Retrieve the values of a char-valued array attribute by its name and indices

MDOsetcharattrlist()

Set the values of a char-valued array attribute by its name and indices

MDOgetstrattr()

Retrieve a string-valued attribute by its name

MDOsetstrattr()

Set the string value attribute by its name

MDOgetstrattrelement()

Retrieve a string-valued attribute by its name and index

MDOsetstrattrelement()

Set element in a string-valued array attribute by its name and index

MDOgetstrattrarray()

Retrieve the values of a string-valued array attribute by its name and range

MDOsetstrattrarray()

Set the values of a string-valued array attribute by its name and range

MDOgetstrattrlist()

Retrieve the values of an string-valued array attribute by its name and indices

MDOsetstrattrlist()

Set the values of a string-valued array attribute by its name and indices

MDOgetmatattrelement()

Retrieve a matrix-valued attribute by its name and index

MDOsetmatattrelement()

Set element in a matrix-valued array attribute by its name and index

MDOgetmatattrarray()

Retrieve the values of a matrix-valued array attribute by its name and range

MDOsetmatattrarray()

Set the values of a matrix-valued array attribute by its name and range

MDOgetmatattrlist()

Retrieve the values of an matrix-valued array attribute by its name and indices

MDOsetmatattrlist()

Set the values of a matrix-valued array attribute by its name and indices

int MDOgetattrinfo(MDOmodel *model, const char *attrname, int *datatypeP, int *attrtypeP, int *settableP)

Retrieve attribute information by its name.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • datatypeP (int*) –

    [out] The place to hold attribute value type. attribute data types include:

    • 0 for char,

    • 1 for int,

    • 2 for double,

    • 3 for string,

    • and 4 for matrix.

  • attrtypeP (int*) –

    [out] The place to hold attribute type. attribute types include:

    • 0 for model attribute,

    • 1 for variable attribute,

    • 2 for linear constraint attribute,

    • 3 for sos constraint attribute,

    • 4 for qudratic constraint attribute,

    • 5 for general constraint attribute,

    • 6 for psd variable attribute,

    • and 7 for psd constraint attribute

  • settableP (int*) – [out] The place to hold a bool value to tell if it’s settable.

Returns

A response code that specifies the status of the function.

int MDOgetintattr(MDOmodel *model, const char *attrname, int *valueP)

Retrieve an integer-valued attribute by its name.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • valueP (int*) – [out] The place to hold attribute value.

Returns

A response code that specifies the status of the function.

int MDOsetintattr(MDOmodel *model, const char *attrname, int newvalue)

Set an integer-valued attribute by its name.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • newvalue (int) – [in] The new attribute value.

Returns

A response code that specifies the status of the function.

int MDOgetintattrelement(MDOmodel *model, const char *attrname, int element, int *valueP)

Retrieve an integer-valued attribute by its name and index.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • element (int) – [in] The attribute index.

  • valueP (int*) – [out] The place to hold attribute value.

Returns

A response code that specifies the status of the function.

int MDOsetintattrelement(MDOmodel *model, const char *attrname, int element, int newvalue)

Set element in an integer-valued array attribute by its name and index.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • element (int) – [in] The attribute index.

  • newvalue (int) – [in] The new attribute value.

Returns

A response code that specifies the status of the function.

int MDOgetintattrarray(MDOmodel *model, const char *attrname, int start, int len, int *values)

Retrieve the values of an integer-valued array attribute by its name and range.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • start (int) – [in] The range start.

  • len (int) – [in] The length of range.

  • values (int*) – [out] The place to hold the values.

Returns

A response code that specifies the status of the function.

int MDOsetintattrarray(MDOmodel *model, const char *attrname, int start, int len, int *values)

Set the values of an integer-valued array attribute by its name and range.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • start (int) – [in] The range start.

  • len (int) – [in] The length of range.

  • values (int*) – [in] The array to hold new values.

Returns

A response code that specifies the status of the function.

int MDOgetintattrlist(MDOmodel *model, const char *attrname, int len, int *ind, int *values)

Retrieve the values of an integer-valued array attribute by its name and indices.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • len (int) – [in] The length of ind .

  • ind (int*) – [in] The indices to fetch values.

  • values (int*) – [out] The place to hold the values.

Returns

A response code that specifies the status of the function.

int MDOsetintattrlist(MDOmodel *model, const char *attrname, int len, int *ind, int *values)

Set the values of an integer-valued array attribute by its name and indices.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • len (int) – [in] The length of ind .

  • ind (int*) – [in] The indices to set values.

  • values (int*) – [in] The array to hold new values.

Returns

A response code that specifies the status of the function.

int MDOgetdblattr(MDOmodel *model, const char *attrname, double *valueP)

Retrieve a double-valued attribute by its name.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • valueP (double*) – [out] The place to hold attribute value.

Returns

A response code that specifies the status of the function.

int MDOsetdblattr(MDOmodel *model, const char *attrname, double newvalue)

Set a double-valued attribute by its name.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • newvalue (double) – [in] The new attribute value.

Returns

A response code that specifies the status of the function.

int MDOgetdblattrelement(MDOmodel *model, const char *attrname, int element, double *valueP)

Retrieve a double-valued attribute by its name and index.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • element (int) – [in] The attribute index.

  • valueP (double*) – [out] The place to hold attribute value.

Returns

A response code that specifies the status of the function.

int MDOsetdblattrelement(MDOmodel *model, const char *attrname, int element, double newvalue)

Set element in a double-valued array attribute by its name and index.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • element (int) – [in] The attribute index.

  • newvalue (double) – [in] The new attribute value.

Returns

A response code that specifies the status of the function.

int MDOgetdblattrarray(MDOmodel *model, const char *attrname, int start, int len, double *values)

Retrieve the values of a double-valued array attribute by its name and range.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • start (int) – [in] The range start.

  • len (int) – [in] The length of range.

  • values (double*) – [out] The place to hold the values.

Returns

A response code that specifies the status of the function.

int MDOsetdblattrarray(MDOmodel *model, const char *attrname, int start, int len, double *values)

Set the values of a double-valued array attribute by its name and range.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • start (int) – [in] The range start.

  • len (int) – [in] The length of range.

  • values (double*) – [in] The array to hold new values.

Returns

A response code that specifies the status of the function.

int MDOgetdblattrlist(MDOmodel *model, const char *attrname, int len, int *ind, double *values)

Retrieve the values of a double-valued array attribute by its name and indices.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • len (int) – [in] The length of ind .

  • ind (int*) – [in] The indices to fetch values.

  • values (double*) – [out] The place to hold the values.

Returns

A response code that specifies the status of the function.

int MDOsetdblattrlist(MDOmodel *model, const char *attrname, int len, int *ind, double *values)

Set the values of a double-valued array attribute by its name and indices.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • len (int) – [in] The length of ind .

  • ind (int*) – [in] The indices to set values.

  • values (double*) – [in] The array to hold new values.

Returns

A response code that specifies the status of the function.

int MDOgetcharattrelement(MDOmodel *model, const char *attrname, int element, char *valueP)

Retrieve a char-valued attribute by its name and index.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • element (int) – [in] The attribute index.

  • valueP (char*) – [out] The place to hold attribute value.

Returns

A response code that specifies the status of the function.

int MDOsetcharattrelement(MDOmodel *model, const char *attrname, int element, char newvalue)

Set element in a char-valued array attribute by its name and index.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • element (int) – [in] The attribute index.

  • newvalue (char) – [in] The new attribute value.

Returns

A response code that specifies the status of the function.

int MDOgetcharattrarray(MDOmodel *model, const char *attrname, int start, int len, char *values)

Retrieve the values of a char-valued array attribute by its name and range.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • start (int) – [in] The range start.

  • len (int) – [in] The length of range.

  • values (char*) – [out] The place to hold the values.

Returns

A response code that specifies the status of the function.

int MDOsetcharattrarray(MDOmodel *model, const char *attrname, int start, int len, char *values)

Set the values of a char-valued array attribute by its name and range.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • start (int) – [in] The range start.

  • len (int) – [in] The length of range.

  • values (char*) – [in] The array to hold new values.

Returns

A response code that specifies the status of the function.

int MDOgetcharattrlist(MDOmodel *model, const char *attrname, int len, int *ind, char *values)

Retrieve the values of a char-valued array attribute by its name and indices.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • len (int) – [in] The length of ind .

  • ind (int*) – [in] The indices to fetch values.

  • values (char*) – [out] The place to hold the values.

Returns

A response code that specifies the status of the function.

int MDOsetcharattrlist(MDOmodel *model, const char *attrname, int len, int *ind, char *values)

Set the values of a char-valued array attribute by its name and indices.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • len (int) – [in] The length of ind .

  • ind (int*) – [in] The indices to set values.

  • values (char*) – [in] The array to hold new values.

Returns

A response code that specifies the status of the function.

int MDOgetstrattr(MDOmodel *model, const char *attrname, char **valueP)

Retrieve a string-valued attribute by its name. Note that all functions that return string-valued attributes are returning pointers into internal model data structures.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • valueP (char**) – [out] The place to hold attribute value.

Returns

A response code that specifies the status of the function.

int MDOsetstrattr(MDOmodel *model, const char *attrname, const char *newvalue)

Set the string value attribute by its name.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The name of the attribute.

  • newvalue (const char*) – [in] The new property value.

Returns

The response code that specifies the function status.

int MDOgetstrattrelement(MDOmodel *model, const char *attrname, int element, char **valueP)

Retrieve a string-valued attribute by its name and index. Note that all functions that return string-valued attributes are returning pointers into internal model data structures.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • element (int) – [in] The attribute index.

  • valueP (char**) – [out] The place to hold attribute value, these values are references.

Returns

A response code that specifies the status of the function.

int MDOsetstrattrelement(MDOmodel *model, const char *attrname, int element, char *newvalue)

Set element in a string-valued array attribute by its name and index.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • element (int) – [in] The attribute index.

  • newvalue (char*) – [in] The new attribute value.

Returns

A response code that specifies the status of the function.

int MDOgetstrattrarray(MDOmodel *model, const char *attrname, int start, int len, char **values)

Retrieve the values of a string-valued array attribute by its name and range. Note that all functions that return string-valued attributes are returning pointers into internal model data structures.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • start (int) – [in] The range start.

  • len (int) – [in] The length of range.

  • values (char**) – [out] The place to hold the values.

Returns

A response code that specifies the status of the function.

int MDOsetstrattrarray(MDOmodel *model, const char *attrname, int start, int len, char **values)

Set the values of a string-valued array attribute by its name and range.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • start (int) – [in] The range start.

  • len (int) – [in] The length of range.

  • values (char**) – [in] The array to hold new values.

Returns

A response code that specifies the status of the function.

int MDOgetstrattrlist(MDOmodel *model, const char *attrname, int len, int *ind, char **values)

Retrieve the values of an string-valued array attribute by its name and indices. Note that all functions that return string-valued attributes are returning pointers into internal model data structures.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • len (int) – [in] The length of ind .

  • ind (int*) – [in] The indices to fetch values.

  • values (char**) – [out] The place to hold the values.

Returns

A response code that specifies the status of the function.

int MDOsetstrattrlist(MDOmodel *model, const char *attrname, int len, int *ind, char **values)

Set the values of a string-valued array attribute by its name and indices.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • len (int) – [in] The length of ind .

  • ind (int*) – [in] The indices to set values.

  • values (char**) – [in] The array to hold new values.

Returns

A response code that specifies the status of the function.

int MDOgetmatattrelement(MDOmodel *model, const char *attrname, int element, int *nummatnz, int *rows, int *cols, int *indices, double *values)

Retrieve a matrix-valued attribute by its name and index.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • element (int) – [in] The attribute index.

  • nummatnz (int*) – [out] The number of matrix entries.

  • rows (int*) – [out] The number of rows for matrix.

  • cols (int*) – [out] The number of columns for matrix.

  • indices (int*) – [out] The indices of matrix entries.

  • values (double*) – [out] The values of matrix entries.

Returns

A response code that specifies the status of the function.

int MDOsetmatattrelement(MDOmodel *model, const char *attrname, int element, int nummatnz, int rows, int cols, int *indices, double *values)

Set element in a matrix-valued array attribute by its name and index.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • element (int) – [in] The attribute index.

  • nummatnz (int) – [in] The number of matrix entries.

  • rows (int) – [in] The number of rows for matrix.

  • cols (int) – [in] The number of columns for matrix.

  • indices (int*) – [in] The indices of matrix entries.

  • values (double*) – [in] The values of matrix entries.

Returns

A response code that specifies the status of the function.

int MDOgetmatattrarray(MDOmodel *model, const char *attrname, int start, int len, int *nummatnz, int *mbgn, int *rows, int *cols, int *indices, double *values)

Retrieve the values of a matrix-valued array attribute by its name and range.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • start (int) – [in] The range start.

  • len (int) – [in] The length of range.

  • nummatnz (int*) – [out] The number of matrix entries.

  • mbgn (int*) – [out] The beginning index for each element. Can be NULL.

  • rows (int*) – [out] The number of rows for each matrix. Can be NULL.

  • cols (int*) – [out] The number of columns for each matrix. Can be NULL.

  • indices (int*) – [out] The indices of matrix entries. Can be NULL.

  • values (double*) – [out] The values of matrix entries. Can be NULL.

Returns

A response code that specifies the status of the function.

int MDOsetmatattrarray(MDOmodel *model, const char *attrname, int start, int len, int nummatnz, int *mbgn, int *rows, int *cols, int *indices, double *values)

Set the values of a matrix-valued array attribute by its name and range.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • start (int) – [in] The range start.

  • len (int) – [in] The length of range.

  • nummatnz (int) – [in] The number of matrix entries.

  • mbgn (int*) – [in] The beginning index for each element.

  • rows (int*) – [in] The number of rows for each matrix.

  • cols (int*) – [in] The number of columns for each matrix.

  • indices (int*) – [in] The indices of matrix entries.

  • values (double*) – [in] The values of matrix entries.

Returns

A response code that specifies the status of the function.

int MDOgetmatattrlist(MDOmodel *model, const char *attrname, int len, int *mind, int *nummatnz, int *mbgn, int *rows, int *cols, int *indices, double *values)

Retrieve the values of an matrix-valued array attribute by its name and indices.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • len (int) – [in] The length of mind .

  • mind (int*) – [in] The indices to fetch values.

  • nummatnz (int*) – [out] The number of matrix entries.

  • mbgn (int*) – [out] The beginning index for each element. Can be NULL.

  • rows (int*) – [out] The number of rows for each matrix. Can be NULL.

  • cols (int*) – [out] The number of columns for each matrix. Can be NULL.

  • indices (int*) – [out] The indices of matrix entries. Can be NULL.

  • values (double*) – [out] The values of matrix entries. Can be NULL.

Returns

A response code that specifies the status of the function.

int MDOsetmatattrlist(MDOmodel *model, const char *attrname, int len, int *mind, int nummatnz, int *mbgn, int *rows, int *cols, int *indices, double *values)

Set the values of a matrix-valued array attribute by its name and indices.

Parameters
  • model (MDOmodel*) – [in] The model object.

  • attrname (const char*) – [in] The attribute name.

  • len (int) – [in] The length of mind .

  • mind (int*) – [in] The indices to fetch values.

  • nummatnz (int) – [in] The number of matrix entries.

  • mbgn (int*) – [in] The beginning index for each element.

  • rows (int*) – [in] The number of rows for each matrix.

  • cols (int*) – [in] The number of columns for each matrix.

  • indices (int*) – [in] The indices of matrix entries.

  • values (double*) – [in] The values of matrix entries.

Returns

A response code that specifies the status of the function.