The function `ECOS_csolve`

is a wrapper around the ecos
`csolve`

C function. Conic constraints are specified using the
*G* and *h* parameters and can be `NULL`

and zero
length vector respectively indicating an absence of conic
constraints. Similarly, equality constraints are specified via
*A* and *b* parameters with `NULL`

and empty vector
values representing a lack of such constraints. At most one of the
pair *(G , h)* or *(A, b)* is allowed to be absent.

1 2 3 |

`c` |
the coefficients of the objective function; the length of this determines the number of variables |

`G` |
the inequality constraint sparse matrix in compressed column format, e.g. dgCMatrix-class. Can be |

`h` |
the right hand size of the inequality constraint. Can be empty numeric vector. |

`dims` |
is a list of three named elements: |

`A` |
the optional equality constraint sparse matrix in compressed column format, e.g. dgCMatrix-class. Can be |

`b` |
the right hand side of the equality constraint, must be specified if |

`bool_vars` |
the indices of the variables, 1 through |

`int_vars` |
the indices of the variables, 1 through |

`control` |
is a named list that controls various optimization parameters; see ecos.control. |

a list of 8 named items

- x
primal variables

- y
dual variables for equality constraints

- s
slacks for

*Gx + s <= h*,*s \in K*- z
dual variables for inequality constraints

*s \in K*- infostring
gives information about the status of solution

- retcodes
a named integer vector containing four elements

- exitflag
0=

`OPTIMAL`

, 1=`PRIMAL INFEASIBLE`

, 2=`DUAL INFEASIBLE`

, -1=`MAXIT REACHED`

- iter
the number of iteration used

- mi_iter
the number of iterations for mixed integer problems

- numerr
a non-zero number if a numeric error occurred

- summary
a named numeric vector containing

- pcost
value of primal objective

- dcost
value of dual objective

- pres
primal residual on inequalities and equalities

- dres
dual residual

- pinf
primal infeasibility measure

- dinf
dual infeasibility measure

- pinfres
primal infeasibility residual

- dinfres
dual infeasibility residual

- gap
duality gap

- relgap
relative duality gap

- r0
Unknown at the moment to this R package maintainer.

- timing
a named numeric vector of timing information consisting of

- runtime
the total runtime in ecos

- tsetup
the time for setup of the problem

- tsolve
the time to solve the problem

A call to this function will solve the problem:
minimize *c^Tx*, subject to *Ax = b*, and *h - G*x \in K*.

Variables can be constrained to be boolean (1 or 0) or integers. This is indicated
by specifying parameters `bool_vars`

and/or `int_vars`

respectively. If so
indicated, the solutions will be found using a branch and bound algorithm.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ```
## githubIssue98
G <- local({
Gpr <- c(0.416757847405471, 2.136196095668454, 1.793435585194863, -1.,
0.056266827226329, -1.640270808404989, 0.841747365656204, -1.,
0.416757847405471, 2.136196095668454, 1.793435585194863, -1.,
0.056266827226329, -1.640270808404989, 0.841747365656204, -1., -1.)
Gjc <- as.integer(c(0, 4, 8, 12, 16, 17))
Gir <- as.integer(c(0, 1, 2, 7, 0, 1, 2, 8, 3, 4, 5, 9, 3, 4, 5, 10, 6))
Matrix::sparseMatrix(i = Gir, p = Gjc, x = Gpr, index1 = FALSE)
})
print(G)
c <- as.numeric(c(0, 0, 0, 0, 1))
h <- as.numeric(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
dims <- list(l = 6L, q = 5L, e = 0L)
ECOS_csolve(c = c, G = G, h = h,
dims = dims,
A = NULL, b = numeric(0))
## A larger problem using saved data for the large matrices
MPC01 <- readRDS(system.file("misc", "MPC01.rds", package="ECOSolveR"))
retval <- ECOS_csolve(c = MPC01$c, G = MPC01$G, h = MPC01$h,
dims = MPC01$dims)
retval$retcodes
retval$infostring
retval$summary
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.