8.1.2. Model management

All basic API functions related to controlling a model are declared in this file, including

  • creating an empty model with default parameter settings;

  • adding new variables and constraints;

  • destroying the loaded model and all associated data.

Examples

MdoI32 itmp = 0;
MdoReal dtmp = 0.0;

MdoMdl * model = NULL;
Mdo_createMdl(&model);

/* Set/get minimization sense. */
Mdo_setMaxObjSense(model);
itmp = Mdo_isMaxObjSense(model);
Mdo_setMinObjSense(model);
itmp = Mdo_isMinObjSense(model);

/* Set/get col information of this model */
int var_indices[] = {0, 1, 2, 3};
double objs[4] = {0};
double lbs[] =  {  1.0,          2.0,          3.0,          4.0 };
double ubs[] =  { 10.0,         20.0,         30.0, MDO_INFINITY };
double lbs_chk[4] = {0};
double ubs_chk[4] = {0};
MdoBool integers_array[4] = {0, 1, 1, 0};
MdoBool integers_chk[4] = {0};
const char* col_names_array[] = { "var0", "var1", "var2", "var3" };
char col_name_chk[1024] = { "\0" };
int col_index;

Mdo_getObjs(model, 4, var_indices, objs);
Mdo_setLbs(model, 4, var_indices, lbs);
Mdo_getLbs(model, 4, var_indices, lbs_chk);
Mdo_setUbs(model, 4, var_indices, ubs);
Mdo_getUbs(model, 4, var_indices, ubs_chk);
Mdo_setIntegers(model, 4, var_indices, integers_array);
Mdo_getIntegers(model, 4, var_indices, integers_chk);
Mdo_setColNames(model, 4, var_indices, col_names_array);
Mdo_getColName(model, 0, col_name_chk, 1024, NULL);
col_index = Mdo_getColIndex(model, "var1");
Mdo_setObjOffset(model, 10.0);
dtmp = Mdo_getObjOffset(model);

/* Set/get row information of this model */
int cons_indices[] = {0, 1};
double lhss[] = { -1, 10            };
double rhss[] = { 1, MDO_INFINITY };
double lhss_chk[2] = {0};
double rhss_chk[2] = {0};
const char* row_names_array[] = { "cons0", "cons1" };
char row_name_chk[1024] = { "\0" };
int row_index;

Mdo_setLhss(model, 2, cons_indices, lhss);
Mdo_getLhss(model, 2, cons_indices, lhss_chk);
Mdo_setRhss(model, 2, cons_indices, rhss);
Mdo_getRhss(model, 2, cons_indices, rhss_chk);
Mdo_setRowNames(model, 2, cons_indices, row_names_array);
Mdo_getRowName(model, 0, row_name_chk, 1024, NULL);
row_index = Mdo_getRowIndex(model, "cons1");

/* Check elements of this model */
int row_indices[] =
{
    0,   0,   0,   0,
    1,        1,   1
};
int col_indices[] =
{
    0,   1,   2,   3,
    0,        2,   3
};
const double elements_value[] =
{
    1.0, 2.0,  3.0,  4.0,
    -1.0,      -2.0, -3.0
};
double elements_chk[7];

Mdo_setElements(model, 7, row_indices, col_indices, elements_value);
Mdo_getElements(model, 7, row_indices, col_indices, elements_chk);

/* Solve */
Mdo_solveProb(model);

/* Check dim. */
itmp = Mdo_getNumRows(model);
itmp = Mdo_getNumCols(model);
itmp = Mdo_getNumElements(model);

/* Delete */
int row_indices_delete[] =
{
    0,
    1
};
int col_indices_delete[] =
{
    2,
       3
};

Mdo_deleteElements(model, 2, row_indices_delete, col_indices_delete);
Mdo_getIntAttr(model, "NumEnts", &itmp);
Mdo_deleteRows(model, 2, cons_indices);
Mdo_getIntAttr(model, "NumConss", &itmp);
Mdo_deleteCols(model, 4, var_indices);
Mdo_getIntAttr(model, "NumVars", &itmp);

/* Free model */
Mdo_freeMdl(&model);

Functions

MdoResult Mdo_createMdl(MdoMdlPtr *mdl)

This function creates an empty MindOpt model default parameter settings.

Parameters
  • mdl – Pointer to the memory address of the model pointer.

Return

A response code that specifies the status of the function.

See

Mdo_freeMdl()

void Mdo_freeMdl(MdoMdlPtr *mdl)

This function destroys a model and all associated data.

Parameters
  • mdl – Pointer to the memory address of the model pointer.

See

Mdo_createMdl()

void Mdo_copyMdl(MdoMdlCptr mdl)

This function creates a new copy of an existing model. Note that only the model and the user-specified options will be copied.

Parameters
  • mdl – Constant pointer to the model.

Return

A pointer to a new model. If this function fails to create a copy, a NULL pointer will be returned.

See

Mdo_freeMdl()

MdoResult Mdo_loadModel(MdoMdlPtr mdl, MdoI32 num_cols, MdoI32 num_rows, const MdoI32 *bgn, const MdoI32 *indices, const MdoReal *values, const MdoReal *lbs, const MdoReal *ubs, const MdoReal *objs, const MdoBool *are_integers, MdoReal obj_const, MdoBool is_min, const MdoReal *lhss, const MdoReal *rhss, const char *const *col_names, const char *const *row_names)

Load in a problem.

Parameters
  • mdl – Pointer to the model.

  • num_cols – Number of columns (variables).

  • num_rows – Number of rows (constraints).

  • bgn – An integer array that defines the beginning index of a CSC (compressed sparse column) matrix. Here bgn must have num_cols + 1 elements; as a result the length of the last column is bgn[num_cols] - bgn[num_cols - 1].

  • indices – An integer array that defines the column index of nonzero elements in the CSC matrix.

  • values – A real array that defines the values of nonzero elements in the CSC matrix.

  • lbs – A real array that holds the lower bounds of variables. Can be NULL; in this case 0 will be used as the default value for all lower bounds.

  • ubs – A real array that holds the upper bounds of variables. Can be NULL; in this case ∞ will be used as the default value for all upper bounds.

  • objs – A real array that holds the linear objective coefficients. Can be NULL; in this case 0 will be used as the default value for all objective coefficients.

  • are_integers – A flag array that specifies if a variable is an integer variable or not. Can be NULL; in this case all variables will be treated as continuous variables.

  • obj_const – The objective offset.

  • is_min – A boolean flag to specify if the objective function has a minimization sense.

  • lhss – A real array that holds the lower bounds (LHS-values) of constraints. Can be NULL; in this case −∞ will be used as the default value for all lower bounds.

  • rhss – A real array that holds the upper bounds (RHS-values) of constraints. Can be NULL; in this case will be used as the default value for all upper bounds.

  • col_names – A pointer array that holds the column (variable) names. Can be NULL.

  • row_names – A pointer array that holds the row (constraint) names. Can be NULL.

Return

A response code that specifies the status of the function.

Note

Here the constraint matrix is is specified with standard compressed sparse column (CSC) matrix that includes column starts (bgn), row indices (indices), and nonzero elements (values). Note that bgn must have num_cols + 1 elements, as a result, the length of the last column is bgn[num_cols] - bgn[num_cols - 1].

MdoResult Mdo_addCol(MdoMdlPtr mdl, MdoReal lb, MdoReal ub, MdoReal obj, MdoI32 size, const MdoI32 *indices, const MdoReal *values, const char *name, MdoBool is_integer)

Introduce a new column to the model.

Parameters
  • mdl – Pointer to the model.

  • lb – Lower bounded value.

  • ub – Upper bounded value.

  • obj – Objective coefficient.

  • size – Number of the nonzero entries, can be zero.

  • indices – Array that holds the index of all nonzero elements, can be NULL.

  • values – Array that holds the value of all nonzero elements, can be NULL.

  • name – Column name, can be NULL.

  • is_integer – Flag that specifies if this is an integer variable.

Return

A response code that specifies the status of the function.

See

Mdo_addRow(), Mdo_addCols(), Mdo_addRows()

Note

This function adds a new column to the model. A column is defined with the following elements:

  • objective coefficient.

  • lower and upper bounded values on the variable.

  • nonzero elements of the column.

  • column type.

  • column name.

MdoResult Mdo_addCols(MdoMdlPtr mdl, MdoI32 num_cols, const MdoReal *lbs, const MdoReal *ubs, const MdoReal *objs, const MdoI32 *bgn, const MdoI32 *indices, const MdoReal *values, const char *const *col_names, const MdoBool *are_integers)

Add multiple columns to the model.

Parameters
  • mdl – Pointer to the model.

  • num_cols – Number of columns (variables).

  • lbs – A real array that holds the lower bounds of variables. Can be NULL; in this case 0 will be used as the default value for all lower bounds.

  • ubs – A real array that holds the upper bounds of variables. Can be NULL; in this case will be used as the default value for all upper bounds.

  • objs – A real array that holds the linear objective coefficients. Can be NULL; in this case 0 will be used as the default value for all objective coefficients.

  • bgn – An integer array that defines the beginning index of a CSC (compressed sparse column) matrix. Here bgn must have num_cols + 1 elements; as a result the length of the last column is bgn[num_cols] - bgn[num_cols - 1].

  • indices – An integer array that defines the column index of nonzero elements in the CSC matrix.

  • values – A real array that defines the values of nonzero elements in the CSC matrix.

  • col_names – A pointer array that holds the column (variable) names. Can be NULL.

  • are_integers – A flag array that specifies if a variable is an integer variable or not. Can be NULL; in this case all variables will be treated as continuous variables.

Return

A response code that specifies the status of the function.

See

Mdo_addRow(), Mdo_addCol(), Mdo_addRows()

Note

This function adds multiple columns to the model. A column is defined with the following elements:

  • objective coefficient.

  • lower and upper bounded values on the variable.

  • nonzero elements of the column.

  • column type.

  • column name.

MdoResult Mdo_addRow(MdoMdlPtr mdl, MdoReal lhs, MdoReal rhs, MdoI32 size, const MdoI32 *indices, const MdoReal *values, const char *name)

Introduce a new linear constraint to the model.

Parameters
  • mdl – Pointer to the model.

  • lhs – Left-hand-side value.

  • rhs – Right-hand-side value.

  • size – Number of the nonzero entries, can be 0.

  • indices – Array that holds the index of all nonzero elements, can be NULL.

  • values – Array that holds the value of all nonzero elements, can be NULL.

  • name – Row name, can be NULL.

Return

A response code that specifies the status of the function.

See

Mdo_addCol(), Mdo_addRows(), Mdo_addCols()

Note

This function adds a linear constraint to the model. A linear constraint is defined as \(l \leq \sum_j a_j x_j \leq r\), where \(l\) (resp. \(r\)) represents the left (resp. right)-hand-side value of the linear constraint, and \(a_j\) are the nonzero coefficient.

MdoResult Mdo_addRows(MdoMdlPtr mdl, MdoI32 num_rows, const MdoReal *lhss, const MdoReal *rhss, const MdoI32 *bgn, const MdoI32 *indices, const MdoReal *values, const char *const *row_names)

This function adds multiple rows to the model.

Parameters
  • mdl – Pointer to the model.

  • num_rows – Number of rows (constraints).

  • lhss – A real array that holds the lower bounds (LHS-values) of constraints. Can be NULL; in this case −∞ will be used as the default value for all lower bounds.

  • rhss – A real array that holds the upper bounds (RHS-values) of constraints. Can be NULL; in this case will be used as the default value for all upper bounds.

  • bgn – An integer array that defines the beginning index of a CSR (compressed sparse row) matrix. Here bgn must have num_rows + 1 elements; as a result the length of the last row is bgn[num_rows] - bgn[num_rows - 1].

  • indices – An integer array that defines the row index of nonzero elements in the CSR matrix.

  • values – A real array that defines the values of nonzero elements in the CSR matrix.

  • row_names – A pointer array that holds the row (constraint) names. Can be NULL.

Return

A response code that specifies the status of the function.

See

Mdo_addCol(), Mdo_addRow(), Mdo_addCols()

MdoResult Mdo_getCols(MdoMdlCptr mdl, MdoI32 num_cols, MdoI32 *col_indices, MdoI32 *bgn, MdoI32 *indices, MdoReal *values, MdoI32 size, MdoI32 *real_size)

Extract a set of columns from the constraint matrix.

Parameters
  • mdl – Pointer to the model.

  • num_cols – Number of columns to access.

  • col_indices – Indices of columns to access.

  • bgn – An integer array that defines the beginning index of a CSC (compressed sparse column) matrix. Here bgn must have num_cols + 1 elements; as a result the length of the last column is bgn[num_cols] - bgn[num_cols - 1]. Can be NULL.

  • indices – An integer array that defines the column index of nonzero elements in the CSC matrix. Can be NULL.

  • values – A real array that defines the values of nonzero elements in the CSC matrix. Can be NULL.

  • size – Current lenghth of indices or values.

  • real_size – Minimal required lenghth for indices or values.

Return

A response code that specifies the status of the function.

See

Mdo_getRows()

Note

This function allows users to extract a set of columns in the constraint matrix. The buffer arrays indices and values must be pre-allocated by users. If the length of these buffer arrays is not sufficient, then only the first size non-zero elements will be returned, and real_size will hold the minimal required length.

A typical usage of this function is listed below.

  1. Call this function by passing NULL for bgn, indices, or values to obtain the minimal required length, real_size.

  2. Allocate memory for indices and values with real_size elements, and indices with num_cols elements.

  3. Call this function again to obtain the column slices of the constraint matrix.

MdoResult Mdo_getRows(MdoMdlCptr mdl, MdoI32 num_rows, MdoI32 *row_indices, MdoI32 *bgn, MdoI32 *indices, MdoReal *values, MdoI32 size, MdoI32 *real_size)

Extract a set of rows from the constraint matrix.

Parameters
  • mdl – Pointer to the model.

  • num_rows – Number of rows to access.

  • row_indices – Indices of rows to access.

  • bgn – An integer array that defines the beginning index of a CSR (compressed sparse row) matrix. Here bgn must have num_rows + 1 elements; as a result the length of the last row is bgn[num_rows] - bgn[num_rows - 1]. Can be NULL.

  • indices – An integer array that defines the row index of nonzero elements in the CSR matrix. Can be NULL.

  • values – A real array that defines the values of nonzero elements in the CSR matrix. Can be NULL.

  • size – Current lenghth of indices or values.

  • real_size – Minimal required lenghth for indices or values.

Return

A response code that specifies the status of the function.

See

Mdo_getCols()

Note

This function allows users to extract a set of rows in the constraint matrix. The buffer arrays indices and values must be pre-allocated by users. If the length of these buffer arrays is not sufficient, then only the first size non-zero elements will be returned, and real_size will hold the minimal required length.

A typical usage of this function is listed below.

  1. Call this function by passing NULL for bgn, indices, or values to obtain the minimal required length, real_size.

  2. Allocate memory for indices and alues with real_size elements, and indices with num_cols elements.

  3. Call this function again to obtain the row slices of the constraint matrix.

MdoResult Mdo_addSymMat(MdoMdlPtr mdl, MdoI32 dim_mat, const char *mat_name)

Add a block variable (symmetric positive semidefinite matrix) to the model.

Parameters
  • mdl – Pointer to the model.

  • dim_mat – Dimension of the added block variable.

  • mat_name – Name of the added block variable. Can be NULL

Return

A response code that specifies the status of the function.

See

Mdo_addSymMats()

MdoResult Mdo_addSymMats(MdoMdlPtr mdl, MdoI32 num_mats, const MdoI32 *dim_mats, const char *const *mat_names)

Add multiple block variables to the model.

Parameters
  • mdl – Pointer to the model.

  • num_mats – Number of block variables to be added.

  • dim_mat – An integer array that holds the dimension of the block variables.

  • mat_name – A pointer array that holds the name of the block variables. Can be NULL

Return

A response code that specifies the status of the function.

MdoResult Mdo_replaceSymMatObjs(MdoMdlPtr mdl, MdoI32 mat_index, MdoI32 size, const MdoI32 *mat_row_indices, const MdoI32 *mat_col_indices, const MdoReal *mat_values)

Replace the values of the specified block variable in the objective function.

Parameters
  • mdl – Pointer to the model.

  • mat_index – Block variable index.

  • size – Number of elements of the block variable to access.

  • mat_row_indices – An array that holds the row indices of the block variable.

  • mat_col_indices – An array that holds the column indices of the block variable.

  • mat_values – An array that holds the objective coefficients associated with the block variable.

Return

A response code that specifies the status of the function.

MdoResult Mdo_replaceSymMatElements(MdoMdlPtr mdl, MdoI32 row_index, MdoI32 mat_index, MdoI32 size, const MdoI32 *mat_row_indices, const MdoI32 *mat_col_indices, const MdoReal *mat_values)

Replace the values of the specified block variable in the constraints.

Parameters
  • mdl – Pointer to the model.

  • row_index – Row index.

  • mat_index – Block variable index.

  • size – Number of elemenets to access.

  • mat_row_indices – An array that holds the row indices of the block variable.

  • mat_col_indices – An array that holds the column indices of the block variable.

  • mat_values – An array that holds the nonzero values associated with the block variable.

Return

A response code that specifies the status of the function.

MdoResult Mdo_getRealAttrSymMat(const MdoMdlPtr mdl, const char *att, const MdoI32 mat_index, MdoI32 size, const MdoI32 *mat_row_indices, const MdoI32 *mat_col_indices, MdoReal *mat_values)

Retrieve the values associated with the specified block variable attribute.

Parameters
  • mdl – Pointer to the model.

  • att – A real-valued symmetric variable attribute to access.

  • mat_index – Block variable index.

  • size – Number of elements of the block variable to access.

  • mat_row_indices – An array that holds the row indices of the block variable.

  • mat_col_indices – An array that holds the column indices of the block variable.

  • mat_values – An array that will holds the values associated with the specified block variable of the attribute.

Return

A response code that specifies the status of the function.

MdoBool Mdo_isMinObjSense(MdoMdlCptr mdl)

This function checks if the objective function has a minimization sense.

Parameters
  • mdl – Constant pointer to the model.

Return

A boolean flag that specifies if the objective function has a minimization sense.

MdoBool Mdo_isMaxObjSense(MdoMdlCptr mdl)

This function checks if the objective function has a maximization sense.

Parameters
  • mdl – Constant pointer to the model.

Return

A boolean flag that specifies if the objective function has a maximization sense.

void Mdo_setMinObjSense(MdoMdlPtr mdl)

This function changes the objective function of the loaded problem to minimization sense.

Parameters
  • mdl – Pointer to the model.

void Mdo_setMaxObjSense(MdoMdlPtr mdl)

This function changes the objective function of the loaded problem to maximization sense.

Parameters
  • mdl – Pointer to the model.

MdoReal Mdo_getObjOffset(MdoMdlCptr mdl)

This function retrieves the objective offset (constant term).

Parameters
  • mdl – Constant pointer to the model.

Return

The value of the objective offset (constant term).

void Mdo_setObjOffset(MdoMdlPtr mdl, MdoReal obj_fix)

This function retrieves the objective offset (constant term).

Parameters
  • mdl – Pointer to the model.

  • obj_fix – New objective offset (fixed cost).

MdoI32 Mdo_getNumRows(MdoMdlCptr mdl)

This function retrieves the total number of rows.

Parameters
  • mdl – Constant pointer to the model.

Return

Total number of rows.

MdoI32 Mdo_getNumCols(MdoMdlCptr mdl)

This function retrieves the total number of columns.

Parameters
  • mdl – Constant pointer to the model.

Return

Total number of columns.

MdoI32 Mdo_getNumElements(MdoMdlCptr mdl)

This function retrieves the total number of the nonzero entries.

Parameters
  • mdl – Constant pointer to the model.

Return

Total number of the nonzero entries.

MdoResult Mdo_getObjs(MdoMdlCptr mdl, MdoI32 size, const MdoI32 *indices, MdoReal *objs)

This function retrieves a set of objective coefficients.

Parameters
  • mdl – Constant pointer to the model.

  • size – Number of variables to access.

  • indices – An array that holds the index of variables to access.

  • objs – An array that will hold the currnet objective coefficients of each specified variable.

Return

A response code that specifies the status of the function.

MdoResult Mdo_setObjs(MdoMdlPtr mdl, MdoI32 size, const MdoI32 *indices, const MdoReal *objs)

This function modifies a set of objective coefficients.

Parameters
  • mdl – Pointer to the model.

  • size – Number of variables to access.

  • indices – An array that holds the index of variables to access.

  • objs – An array that holds the new objective coefficients for each specified variable.

Return

A response code that specifies the status of the function.

MdoResult Mdo_getLbs(MdoMdlCptr mdl, MdoI32 size, const MdoI32 *indices, MdoReal *lbs)

This function retrieves a set of variable lower bounds.

Parameters
  • mdl – Constant pointer to the model.

  • size – Number of variables to access.

  • indices – An array that holds the index of variables to access.

  • lbs – An array that will hold the currnet lower bounds of each specified variable.

Return

A response code that specifies the status of the function.

MdoResult Mdo_setLbs(MdoMdlPtr mdl, MdoI32 size, const MdoI32 *indices, const MdoReal *lbs)

This function modifies a set of variable lower bounds.

Parameters
  • mdl – Pointer to the model.

  • size – Number of variables to access.

  • indices – An array that holds the index of variables to access.

  • lbs – An array that holds the new lower bounds for each specified variable.

Return

A response code that specifies the status of the function.

MdoResult Mdo_getUbs(MdoMdlCptr mdl, MdoI32 size, const MdoI32 *indices, MdoReal *ubs)

This function retrieves a set of variable upper bounds.

Parameters
  • mdl – Constant pointer to the model.

  • size – Number of variables to access.

  • indices – An array that holds the index of variables to access.

  • ubs – An array that will hold the currnet upper bounds of each specified variable.

Return

A response code that specifies the status of the function.

MdoResult Mdo_setUbs(MdoMdlPtr mdl, MdoI32 size, const MdoI32 *indices, const MdoReal *ubs)

This function modifies a set of variable upper bounds.

Parameters
  • mdl – Pointer to the model.

  • size – Number of variables to access.

  • indices – An array that holds the index of variables to access.

  • ubs – An array that holds the new upper bounds for each specified variable.

Return

A response code that specifies the status of the function.

MdoResult Mdo_getIntegers(MdoMdlCptr mdl, MdoI32 size, const MdoI32 *indices, MdoBool *are_integers)

This function retrieves a set of flags that specifies the current variable types (integer variables or not) of each specified variable.

Parameters
  • mdl – Constant pointer to the model.

  • size – Number of variables to access.

  • indices – An array that holds the index of variables to access.

  • are_integers – An array that will hold the current variable types (integer or not) of each specified variable.

Return

A response code that specifies the status of the function.

MdoResult Mdo_setIntegers(MdoMdlPtr mdl, MdoI32 size, const MdoI32 *indices, const MdoBool *are_integers)

This function modifies a set of variable types (integer variables or not).

Parameters
  • mdl – Pointer to the model.

  • size – Number of variables to access.

  • indices – An array that holds the index of variables to access.

  • are_integers – An array that holds the new variable types (integer or not) for each specified variable.

Return

A response code that specifies the status of the function.

MdoResult Mdo_getColName(MdoMdlCptr mdl, MdoI32 j, char *col_name, MdoI32 size, MdoI32 *real_size)

This function returns the column (variable) name.

Parameters
  • mdl – Constant pointer to the model.

  • j – Column index.

  • col_name – Column name. Can be NULL.

  • size – Max string length.

  • real_size – Real length of the requested name length. Can be NULL.

Return

A response code that specifies the status of the function.

Note

If the length of name is not sufficient, then only the first size characters of the name will be returned, and the actual length of the requested name will be stored in real_size. Note that if name is NULL, then the actual length of name will be returned.

MdoResult Mdo_setColNames(MdoMdlPtr mdl, MdoI32 size, const MdoI32 *indices, const char *const *col_names)

This function modifies a set of variable names.

Parameters
  • mdl – Pointer to the model.

  • size – Number of variables to access.

  • indices – An array that holds the index of variables to access.

  • col_names – An array of new names for each specified variable.

Return

A response code that specifies the status of the function.

MdoI32 Mdo_getColIndex(MdoMdlptr mdl, const char *name)

This function returns the column index of a column name in the model.

Parameters
  • mdl – Constant pointer to the model.

  • name – Column name.

Return

The column index, or -1 if the column name is not found.

MdoResult Mdo_getLhss(MdoMdlptr mdl, MdoI32 size, const MdoI32 *indices, MdoReal *lhss)

This function returns a set of LHS (left-hand-side) values for each specified constraint.

Parameters
  • mdl – Constant pointer to the model.

  • size – Number of constraints to access.

  • indices – An array that holds the index of constraints to access.

  • lhss – An array that will hold the currnet LHS values of each specified constraint.

Return

A response code that specifies the status of the function.

MdoResult Mdo_setLhss(MdoMdlPtr mdl, MdoI32 size, const MdoI32 *indices, const MdoReal *lhss)

This function modifies a set of LHS (left-hand-side) values for each specified constraint.

Parameters
  • mdl – Pointer to the model.

  • size – Number of constraints to access.

  • indices – An array that holds the index of constraints to access.

  • lhss – An array that holds the new LHS values for each specified constraint.

Return

A response code that specifies the status of the function.

MdoResult Mdo_getRhss(MdoMdlptr mdl, MdoI32 size, const MdoI32 *indices, MdoReal *rhss)

This function retrieves a set of RHS (right-hand-side) values for each specified constraint.

Parameters
  • mdl – Constant pointer to the model.

  • size – Number of constraints to access.

  • indices – An array that holds the index of constraints to access.

  • rhss – An array that will hold the currnet RHS values of each specified constraint.

Return

A response code that specifies the status of the function.

MdoResult Mdo_setRhss(MdoMdlPtr mdl, MdoI32 size, const MdoI32 *indices, const MdoReal *rhss)

This function modifies a set of RHS (right-hand-side) values for each specified constraint.

Parameters
  • mdl – Pointer to the model.

  • size – Number of constraints to access.

  • indices – An array that holds the index of constraints to access.

  • rhss – An array that holds the new RHS values for each specified constraint.

Return

A response code that specifies the status of the function.

MdoResult Mdo_getRowName(MdoMdlptr mdl, MdoI32 i, char *row_name, MdoI32 size, MdoI32 *real_size)

This function returns the name of a row(variable).

Parameters
  • mdl – Constant pointer to the model.

  • i – Row index.

  • row_name – Row name. Can be NULL.

  • size – Max string length.

  • real_size – Real length of the requested name length. Can be NULL.

Return

A response code that specifies the status of the function.

Note

If the length of name is not sufficient, then only the first size characters of the name will be returned, and the actual length of the requested name will be stored in real_size. Note that if name is NULL, then the actual length of name will be returned.

MdoResult Mdo_setRowNames(MdoMdlPtr mdl, MdoI32 size, const MdoI32 *indices, const char *const *row_names)

This function modifies a set of constraint names.

Parameters
  • mdl – Pointer to the model.

  • size – Number of constraints to access.

  • indices – An array that holds the index of constraints to access.

  • row_names – An array of new names for each specified constraint.

Return

A response code that specifies the status of the function.

MdoI32 Mdo_getRowIndex(MdoMdlptr mdl, const char *name)

This function returns the row index of a row name in the model.

Parameters
  • mdl – Constant pointer to the model.

  • name – Row name.

Return

The row index, or -1 if the row name is not found.

MdoResult Mdo_getElements(MdoMdlptr mdl, MdoI32 size, const MdoI32 *row_indices, const MdoI32 *col_indices, MdoReal *values)

This function retrieves a set of values of all specified elements in the constraint matrix.

Parameters
  • mdl – Constant pointer to the model.

  • size – Number of elemenets to access.

  • row_indices – An array that holds the row index of elements to access.

  • col_indices – An array that holds the column index of elements to access.

  • values – An array that will hold the current nonzero values of all specified elements in the constraint matrix.

Return

A response code that specifies the status of the function.

MdoResult Mdo_setElements(MdoMdlPtr mdl, MdoI32 size, const MdoI32 *row_indices, const MdoI32 *col_indices, const MdoReal *values)

This function modifies a set of values of all specified elements in the constraint matrix.

Parameters
  • mdl – Pointer to the model.

  • size – Number of elemenets to access.

  • row_indices – An array that holds the row index of elements to access.

  • col_indices – An array that holds the column index of elements to access.

  • values – An array that holds the new nonzero values for all specified elements in the constraint matrix.

Return

A response code that specifies the status of the function.

MdoResult Mdo_setQuadraticElements(MdoMdlPtr mdl, MdoI32 size, const MdoI32 *col_indices1, const MdoI32 *col_indices2, const MdoReal *values)

This function modifies a set of values of all specified elements in the quadratic matrix of a quadratic program.

Parameters
  • mdl – Pointer to the model.

  • size – Number of elemenets to access.

  • col_indices1 – An array that holds the first variable index of elements to access.

  • col_indices2 – An array that holds the second variable index of elements to access

  • values – An array that holds the new nonzero values for all specified elements.

Return

A response code that specifies the status of the function.

MdoResult Mdo_deleteRows(MdoMdlPtr mdl, MdoI32 size, const MdoI32 *indices)

This function removes a set of rows from the model.

Parameters
  • mdl – Pointer to the model.

  • size – Number of rows to be deleted.

  • indices – An array that holds the index of rows to be deleted.

Return

A response code that specifies the status of the function.

MdoResult Mdo_deleteCols(MdoMdlPtr mdl, MdoI32 size, const MdoI32 *indices)

This function removes a set of columns from the model.

Parameters
  • mdl – Pointer to the model.

  • size – Number of columns to be deleted.

  • indices – An array that holds the index of columns to be deleted.

Return

A response code that specifies the status of the function.

MdoResult Mdo_deleteElements(MdoMdlPtr mdl, MdoI32 size, const MdoI32 *row_indices, const MdoI32 *col_indices)

This function deletes a set of elements from the constraint matrix.

Parameters
  • mdl – Pointer to the model.

  • size – Number of elements to be deleted.

  • row_indices – An array that holds the row index of elements to be deleted.

  • col_indices – An array that holds the column index of elements to be deleted.

Return

A response code that specifies the status of the function.

MdoResult Mdo_deleteAllElements(MdoMdlPtr mdl)

This function deletes all elements from the constraint matrix.

Parameters
  • mdl – Pointer to the model.

Return

A response code that specifies the status of the function.

MdoResult Mdo_deleteAllQuadraticElements(MdoMdlPtr mdl)

This function deletes all elements from the quadratic matrix of a quadratic program.

Parameters
  • mdl – Pointer to the model.

Return

A response code that specifies the status of the function.

MdoResult Mdo_relaxIntegrality(MdoMdlPtr mdl)

This function removes all integrality requirements in the model and transforms it into a continuous relaxation problem.

Parameters
  • mdl – Pointer to the model.

Return

A response code that specifies the status of the function.