# lmisolver

Solve linear matrix inequations.

## Calling Sequence

    [XLISTF[,OPT]] = lmisolver(XLIST0,evalfunc [,options])

## Arguments

XLIST0

  a list of containing initial guess (e.g. `XLIST0=list(X1,X2,..,Xn)`)

evalfunc

  a Scilab function ("external" function with specific syntax)

  The syntax the function `evalfunc` must be as follows:

  `[LME,LMI,OBJ]=evalfunct(X)` where `X` is a list of matrices, `LME, LMI` are lists and `OBJ` a real scalar.

XLISTF

  a list of matrices (e.g. `XLIST0=list(X1,X2,..,Xn)`)

options

  optional parameter. If given, `options` is a real row vector with 5 components `[Mbound,abstol,nu,maxiters,reltol]`

## Description

`lmisolver` solves the following problem:

minimize `f(X1,X2,...,Xn)` a linear function of Xi's

under the linear constraints: `Gi(X1,X2,...,Xn)=0` for i=1,...,p and LMI (linear matrix inequalities) constraints:

`Hj(X1,X2,...,Xn) > 0` for j=1,...,q

The functions f, G, H are coded in the Scilab function `evalfunc` and the set of matrices Xi's in the list X (i.e. `X=list(X1,...,Xn)`).

The function `evalfun` must return in the list `LME` the matrices `G1(X),...,Gp(X)` (i.e. `LME(i)=Gi(X1,...,Xn),` i=1,...,p). `evalfun` must return in the list `LMI` the matrices `H1(X0),...,Hq(X)` (i.e. `LMI(j)=Hj(X1,...,Xn)`, j=1,...,q). `evalfun` must return in `OBJ` the value of `f(X)` (i.e. `OBJ=f(X1,...,Xn)`).

`lmisolver` returns in `XLISTF`, a list of real matrices, i. e. `XLIST=list(X1,X2,..,Xn)` where the Xi's solve the LMI problem:

Defining `Y,Z` and `cost` by:

`[Y,Z,cost]=evalfunc(XLIST)`, `Y` is a list of zero matrices, `Y=list(Y1,...,Yp)`, `Y1=0, Y2=0, ..., Yp=0`.

`Z` is a list of square symmetric matrices, `Z=list(Z1,...,Zq)` , which are semi positive definite `Z1>0, Z2>0, ..., Zq>0` (i.e. `spec(Z(j))` > 0),

`cost` is minimized.

`lmisolver` can also solve LMI problems in which the `Xi's` are not matrices but lists of matrices. More details are given in the documentation of LMITOOL.

## Examples

    // Find diagonal matrix X (i.e. X=diag(diag(X), p=1) such that
    //A1'*X+X*A1+Q1 < 0, A2'*X+X*A2+Q2 < 0 (q=2) and trace(X) is maximized

    // Constants
    rand("seed", 0);
    n  = 2;
    A1 = rand(n, n);
    A2 = rand(n, n);
    Xs = diag(1:n);
    Q1 = -(A1'*Xs+Xs*A1+0.1*eye());
    Q2 = -(A2'*Xs+Xs*A2+0.2*eye());

    function [LME, LMI, OBJ] = evalf(Xlist)
      X   = Xlist(1)
      LME = X-diag(diag(X))
      LMI = list(-(A1'*X+X*A1+Q1), -(A2'*X+X*A2+Q2))
      OBJ = -sum(diag(X))
    endfunction

    X = lmisolver(list(zeros(A1)), evalf); // Run optimization, X = [1.0635042 0; 0 2.0784841]

    X = X(1);
    [Y, Z, c] = evalf(X) // Check evaluaton function value at the point found
    // Y = 0
    // Z = list([0.0731600 0.7080179; 0.7080179 0.7186999], [0.1154910 0.5345239; 0.5345239 1.4843684])
    // c = -1.0635042

## See Also

- lmitool