next up previous contents index
Next: Applying the Solver Up: DSDP Subroutine Library Previous: Semidefinite Cone   Contents   Index


LP Cone

To specify an application with a cone of linear scalar inequalities, the subroutine

DSDPCreateLPCone( DSDP dsdp, LPCone *newlpcone)
can be used to create a new object that describes a cone with $1$ or more linear scalar inequalities. The first argument is an existing DSDP solver and the second argument is the address of an LPCone variable. This subroutine will allocate structures needed to specify the constraints and point the variable to this structure. Multiple cones for these inequalities can be created for the same DSDP solver, but it is usually more efficient to group all inequalities of this type into the same structure. All subroutines that pass data to the LP cone use this LPCone variable in the first argument.

A list of $n$ linear inequalities are passed to the object in sparse column format. The vector $c \in \mathbb{R}^n$ should be considered an additional column of the data. (In the formulation (P), the data $A$ and $c$ is represented in sparse row format.)

Pass the data to the LPCone using the subroutine:

LPConeSetData(LPCone lpcone, int n, 
              const int nnzin[], const int row[], const double aval[]);
In this case, the integer array nnzin has length $m+2$, begins with $0$, and ${\tt nnzin[i+1]-nnzin[i]}$ equals the number of nonzeros in column $i$ ( $ i= 0, \ldots m$) (or row $i$ of $A$). The length of the second and third array equals the number of nonzeros in $A$ and $c$. The arrays contain the nonzeros and the associated row numbers of each element (or column numbers in $A$). The first column contains the elements of $c$, the second column contains the elements corresponding to $y_1$, and the last column contains elements corresponding to $y_m$.

For example, the following problems in the form of (D):

\begin{displaymath}\begin{array}{llllll}
\mbox{Maximize} & & y_1 & + & y_2 \\
\...
... & 7 y_2 & \leq 10 \\
& & & & - y_2 & \leq 12 \\
\end{array}\end{displaymath}

In this example, there three inequalities, so the dimension of the $x$ vector would be $3$ and $n=3$. The input arrays would be as follows:

\begin{displaymath}\begin{array}{ll}
\tt {nnzin} & = \left[ \begin{array}{cccc}...
...4.0 & 3.0 & 2.0 & 7.0 & -1.0\end{array} \right] \\
\end{array}\end{displaymath}

An example of the use of this subroutine can be seen in the DSDPROOT/examples/readsdpa.c.

If its more convenient to specify the vector $c$ in the last column, consider using the subroutine:

LPConeSetData2(LPCone lpcone,int n, const int ik[],const int cols[],const double vals[]);
This input is also sparse column input, but the first column corr In this form the input arrays would be as follows:

\begin{displaymath}\begin{array}{ll}
\tt {nnzin} & = \left[ \begin{array}{cccc}...
...0 & -1.0 & 6.0 & 10.0 & 12.0\end{array} \right] \\
\end{array}\end{displaymath}

This subroutine is used in the DSDP Matlab mex function, which can be used as an example.

The subroutines

LPConeView(LPCone lpcone);
LPConeView2(LPCone lpcone);
can be used to view the data that has been set and verify the correctness of the data. Multiple LPCone structures can be used, but for efficiency purposes, it is often better to include all linear inequalities in a single cone.

The variables $s$ in (D) and $x$ in (P) can be found using the subroutines

LPConeGetXArray(LPCone lpcone,double *xout[], int *n);
LPConeGetSArray(LPCone lpcone,double *sout[], int *n);
In these subroutines, the second argument sets a pointer to an an array of doubles containing the variables and the integer in the third argument will be set to the length of this array. These array were allocated by the LPCone object and the memory will be freed with the DSDP solver object is destroyed. Alternatively, the application can give the LPCone an array in which to put the solution $x$ of (P). This array should be passed to the cone using the following subroutine
LPConeSetXVec(LPCone lpcone,double xout[], int n);
At completion of the DSDP solver, the solution $x$ will be copied into this array xout, which must have length $n$. The slack variables $s$ may be scaled. To get the unscaled vector, pass an array of appropriate length into the object using int LPConeGetSArray2(LPCone lpcone, double s[], int n);. This subroutine will copy the slack variables into the array.

In some applications it may be useful to fix a variable to a number. Instead of modeling this constraint as a pair of linear inequalities, fixed variables can be passed directly to the solver using the subroutine

DSDPSetFixedVariables(DSDP dsdp, double vars[], double vals[], double x[],int n);
In this subroutine, the array of variables in the second argument is set to the values in the array of the third argument. The fourth argument is an optional array in which the solver will put the sensitivities to these fixed variables. The final argument is the length of the arrays. Note, the values in the second argument are integer numbers from $1$ to $m$ represented in double precision. Again, the integers should be one of $1, \ldots, m$. Alternatively, a single variable can be set to a value using the subroutine DSDPFixVariable(DSDP dsdp, int vari, double val).


next up previous contents index
Next: Applying the Solver Up: DSDP Subroutine Library Previous: Semidefinite Cone   Contents   Index
Steven Benson 2005-02-11