expcone.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * ECOS - Embedded Conic Solver.
  3. * Copyright (C) 2012-2015 A. Domahidi [domahidi@embotech.com],
  4. * Automatic Control Lab, ETH Zurich & embotech GmbH, Zurich, Switzerland.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /*
  20. * The exponental cone module is (c) Santiago Akle, Stanford University,
  21. * [akle@stanford.edu]
  22. *
  23. */
  24. #include "cone.h"
  25. #include "glblopts.h"
  26. #include "wright_omega.h"
  27. #include <math.h>
  28. #ifndef __ECOS_EXP_H__
  29. #define __ECOS_EXP_H__
  30. #if defined EXPCONE
  31. /*
  32. * Exponential cone structure: We save the index where each expcone Hessian
  33. * column starts in the csr format. For each cone we also allocate space for
  34. * the gradient of the barrier at each cone and the values of entries of the
  35. * Hessian matrix
  36. */
  37. typedef struct expcone
  38. {
  39. idxint colstart[3]; /* All cones are fixed size, we store the index
  40. * where the column of the hessian starts in the
  41. * permuted Newton system.
  42. */
  43. pfloat v[6]; /* Uper triangular section of the hessian */
  44. pfloat g[3]; /* Gradient of the barrier */
  45. } expcone;
  46. /*
  47. * Evaluates the Hessian of the exponential dual cone barrier at the triplet
  48. * w[0],w[1],w[2], and stores the upper triangular part of the matrix mu*H(w)
  49. * at v[0],...,v[5]. The entries of the Hessian are arranged columnwise into v
  50. */
  51. void evalExpHessian(pfloat* w, pfloat* v, pfloat mu);
  52. /*
  53. * Evaluates the gradient of the dual exponential cone barrier g^\star(z) at the triplet
  54. * w[0],w[1],w[2], and stores the result at g[0],..,g[2].
  55. */
  56. void evalExpGradient(pfloat* w, pfloat* g);
  57. /*
  58. * Computes f_e(s_e) + f^\star_e(z_e)
  59. */
  60. pfloat evalBarrierValue(pfloat* siter, pfloat *ziter, idxint fc, idxint nexc);
  61. /*
  62. * Multiplies by y+=muH*x
  63. */
  64. void scaleToAddExpcone(pfloat* y, pfloat* x, expcone* expcones, idxint nexc, idxint fc);
  65. /*
  66. * Returns 1 if s is primal feasible w.r.t the primal exponential
  67. * cone and 0 i.o.c
  68. */
  69. idxint evalExpPrimalFeas(pfloat *s, idxint nexc);
  70. /*
  71. * Returns 1 if s is dual feasible w.r.t the dual exponential
  72. * cone and 0 i.o.c
  73. */
  74. idxint evalExpDualFeas(pfloat *s, idxint nexc);
  75. #endif
  76. #endif /* End ifndef __ECOS_EXP_H__ */