DuQuad  v1.0
Quadratic Programming Optimizations
 All Data Structures Files Functions Variables Typedefs Macros
dgm.c
Go to the documentation of this file.
1 /*
2  * DGM.c
3  *
4  * Created on: 27. aug. 2014
5  * Author: Sverre
6  */
7 
8 #include "dgm.h"
9 
10 /* static functions declaration */
11 
12 static int32_t solve_DGM();
13 static real_t dual_obj();
14 static void clean_up_inner_problem();
15 static void init_inner_problem();
16 
17 
18 /* public functions definition */
19 
21 {
22  _SDEBUG("I am in DGM()\n");
23 
24  // Make z0 feasible
25  if(!s->info->ub_is_inf)
26  vector_min(s->prob->ub,s->prob->z0,s->prob->z0,N);
27  if(!s->info->lb_is_inf)
28  vector_max(s->prob->lb,s->prob->z0,s->prob->z0,N);
29 
30  // Initialize the "inner" problem
31  struct Struct_FGM p_in;
32  init_inner_problem(s, &p_in);
33  if (solve_DGM(s,&p_in) == -1){
34  ERROR("Error in solving solveDGM()\n");
35  clean_up_inner_problem(&p_in);
36  return -1;
37  };
38  clean_up_inner_problem(&p_in);
39  _SDEBUG("End of DGM()\n");
40  return 0;
41 }
42 
43 static int32_t solve_DGM(struct Struct_DGM *s, struct Struct_FGM *p_in)
44 {
45  _DEBUG2("problem_case: %d\n", s->info->problem_case);
46 
47  // calculating alpha
48  real_t alpha = 1.0 / (2.0 * s->info->Ld);
49  _DEBUG("alpha %f\n", alpha);
50 
51  // making b+lb_hat and b+ub_hat, because this is an constant operation
52  const uint32_t prob_case = s->info->problem_case;
53  switch (prob_case){
54  case 1:
55  vector_add(s->prob->b,s->prob->ub_hat,s->b_ub_hat,M);
56  vector_add(s->prob->b,s->prob->lb_hat,s->b_lb_hat,M);
57  break;
58  case 2:
59  vector_add(s->prob->b,s->prob->ub_hat,s->b_ub_hat,M);
60  break;
61  case 3:
62  vector_add(s->prob->b,s->prob->ub_hat,s->b_ub_hat,M);
63  break;
64  case 4:
65  vector_add(s->prob->b,s->prob->lb_hat,s->b_lb_hat,M);
66  break;
67  default:
68  ERROR("Error deciding the problem case\n");
69  return -1;
70  }
71 #ifdef DEBUG
72  _DEBUG("s->lambda1: %d ",0); print_vector(s->lambda1,M);
73  _DEBUG("s->lambda2: %d ",0); print_vector(s->lambda2,M);
74 #endif
75 
76  // Dynamc Arrays for ds and pf
77  struct Array ds_array, pf_array;
78  initArray(&ds_array, 100);
79  initArray(&pf_array, 100);
80 
81 
82  // Declaration and initialization of other necessary variables
83  real_t pf = s->opt->eps_pf + 1;
84  uint32_t niter_feasible_ds = 0;
85  uint32_t niter_feasible_pf = 0;
86  uint32_t last_eps_ds;
87  uint32_t niter = 1;
88  real_t dual_value_new = 0.0;
89  real_t dual_value_diff = s->opt->eps_ds + 1;
90  s->res->exitflag = 1;
91  s->res->out->exitflag_inner = 1;
93 
94  // Clock
95  clock_t tic, toc, tic_in, toc_in;
96  tic = clock();
97 
98  // solve inner problem first time
99  // with: c_in = c + A'*lambda1 - A'*lambda2 = c + A'(lambda1-lambda2)
100  // NOTE: As long as lambda1 = lambda2 = 0, c_in = c
101  vector_copy(s->prob->c,p_in->c,N);
102  vector_copy(s->prob->z0,p_in->z0,N); // Initialize z0
103  uint32_t niter_inner = 0;
104 
105  tic_in = clock();
106  niter_inner += FGM(p_in);
107  toc_in = clock();
108 
109  s->res->out->time_tot_inner = (real_t)(toc_in-tic_in);
110  if(p_in->exitflag == 2){
111  s->res->out->exitflag_inner = 2;
113  }
114 
115  vector_copy(p_in->zopt,s->z,N);
116  mtx_vec_mul(s->prob->A,s->z,s->A_z,M,N); // used in dual_obj
117  vector_copy(s->z,s->summ,N);
118 
119 
120  // find the value of the Dual Function (Lagrangian) first time
121  real_t dual_value = dual_obj(s,prob_case);
122 
123  /* ##################################################################################
124  START WHILE-LOOP
125  ################################################################################## */
126 
127  while (dual_value_diff > s->opt->eps_ds || pf > s->opt->eps_pf)
128  {
129 
130  if (niter > s->opt->maxiter_outer){
131  //printf("reached maximum number of iterations in DGM\n");
132  s->res->exitflag = 2;
133  niter_feasible_ds--;
134  niter_feasible_pf--;
135  break;
136  }
137 
138 
139  if (dual_value_diff < s->opt->eps_ds){
140  niter_feasible_ds++;
141  last_eps_ds = 1;
142  }
143  else
144  last_eps_ds = 0;
145 
146  if (pf < s->opt->eps_pf)
147  niter_feasible_pf++;
148 
149  /* *********************************************************************
150  Finding the next lambda
151  ********************************************************************* */
152 
153  // lambda1 += alpha * (A*z - b_lb_hat)
154  // NOTE: re-use the 'lambda1' vector instead of creating 'lambda1_new'
155 
156  switch (prob_case){
157  case 1:
158  // lambda1 += alpha * (A*z - b_lb_hat)
159  vector_sub(s->A_z,s->b_ub_hat,s->temp3_dim_M,M); // ANS - b_ub_hat
160  vector_scalar_mul(s->temp3_dim_M,alpha,s->temp3_dim_M,M); // ANS * alpha
161  vector_add(s->temp3_dim_M,s->lambda1,s->lambda1,M); // lambda1 += ANS
162 
163  // lambda2 += alpha * (-A*z + b_lb_hat)
164  vector_sub(s->b_lb_hat,s->A_z,s->temp3_dim_M,M); // -(A*z) + b_lb_hat
165  vector_scalar_mul(s->temp3_dim_M,alpha,s->temp3_dim_M,M); // ANS * alpha
166  vector_add(s->temp3_dim_M,s->lambda2,s->lambda2,M); // lambda2 += ANS
167 
168  vector_max_with_zero(s->lambda1, M); // project lambda1 on R+
169  vector_max_with_zero(s->lambda2, M); // project lambda2 on R+
170  break;
171  case 2:
172  // lambda1 += alpha * (A*z - b_lb_hat)
173  vector_sub(s->A_z,s->b_ub_hat,s->temp3_dim_M,M); // ANS - b_ub_hat
174  vector_scalar_mul(s->temp3_dim_M,alpha,s->temp3_dim_M,M); // ANS * alpha
175  vector_add(s->temp3_dim_M,s->lambda1,s->lambda1,M); // lambda1 += ANS
176  // NOTE: No projection
177  break;
178  case 3:
179  // lambda1 += alpha * (A*z - b_lb_hat)
180  vector_sub(s->A_z,s->b_ub_hat,s->temp3_dim_M,M); // ANS - b_ub_hat
181  vector_scalar_mul(s->temp3_dim_M,alpha,s->temp3_dim_M,M); // ANS * alpha
182  vector_add(s->temp3_dim_M,s->lambda1,s->lambda1,M); // lambda1 += ANS
183  vector_max_with_zero(s->lambda1, M); // project lambda1 on R+
184  break;
185  case 4:
186  // lambda2 += alpha * (-A*z + b_lb_hat)
187  vector_sub(s->b_lb_hat,s->A_z,s->temp3_dim_M,M); // -(A*z) + b_lb_hat
188  vector_scalar_mul(s->temp3_dim_M,alpha,s->temp3_dim_M,M); // ANS * alpha
189  vector_add(s->temp3_dim_M,s->lambda2,s->lambda2,M); // lambda2 += ANS
190  vector_max_with_zero(s->lambda2, M); // project lambda2 on R+
191  break;
192  default:
193  ERROR("Error deciding the problem case\n");
194  return -1;
195  }
196 
197  /* *********************************************************************
198  Solving the inner problem
199  ********************************************************************* */
200 
201  // First calculate the new c (c_hat) for the inner problem,
202  // c_hat = p_in->c = c + A' * (lambda1 - lambda2)
203  vector_copy(s->prob->c,p_in->c,N);
204 
205  switch (prob_case){
206  case 1:
207  // p_in->c = c + A' * (lambda1 - lambda2)
208  vector_sub(s->lambda1,s->lambda2,s->temp2_dim_M,M); // lambda1 - lambda2
209  mtx_vec_mul(s->prob->A_t,s->temp2_dim_M,s->temp1_dim_N,N,M); // ANS * A'
210  vector_add(p_in->c,s->temp1_dim_N,p_in->c,N); // p_in->c = ANS + c
211  break;
212  case 2:
213  // p_in->c = c + A' * lambda1
214  mtx_vec_mul(s->prob->A_t,s->lambda1,s->temp1_dim_N,N,M); // A' * lambda1
215  vector_add(p_in->c,s->temp1_dim_N,p_in->c,N); // p_in->c = ANS + c
216  break;
217  case 3:
218  // p_in->c = c + A' * lambda1
219  mtx_vec_mul(s->prob->A_t,s->lambda1,s->temp1_dim_N,N,M); // A' * lambda1
220  vector_add(p_in->c,s->temp1_dim_N,p_in->c,N); // p_in->c = ANS + c
221  break;
222  case 4:
223  // p_in->c = c - A' * lambda2
224  mtx_vec_mul(s->prob->A_t,s->lambda2,s->temp1_dim_N,N,M); // A' * lambda2
225  vector_sub(p_in->c,s->temp1_dim_N,p_in->c,N); // p_in->c = c - ANS
226  break;
227  default:
228  ERROR("Error deciding the problem case\n");
229  return -1;
230  }
231 
232  // Compute the new optimal z (s->z) from the inner problem
233  vector_copy(s->z, p_in->z0, N); // Warm start
234 
235  tic_in = clock();
236  niter_inner += FGM(p_in);
237  toc_in = clock();
238  s->res->out->time_tot_inner += (real_t)(toc_in-tic_in);
239  if(p_in->exitflag == 2){
240  s->res->out->exitflag_inner = 2;
242  }
243 
244  vector_copy(p_in->zopt,s->z,N);
245  mtx_vec_mul(s->prob->A,s->z,s->A_z,M,N); // used in dual_obj. Only solved here in the while loop
246 
247  /* *********************************************************************
248  Finding dual_value_diff
249  ********************************************************************* */
250 
251  // calculate the difference between the new and previous Lagrangian value
252  dual_value_new = dual_obj(s,prob_case);
253  dual_value_diff = abs_2(dual_value_new - dual_value);
254  dual_value = dual_value_new;
255 
256  /* *********************************************************************
257  Finding pf
258  ********************************************************************* */
259 
260  // pf = norm2( max([A*z_pf - b_ub_hat ; -A*z_pf + b_lb_hat]) , 0) )
261  // NOTE: Algorithm 1 (last) => we use z_pf = z
262  // Algorithm 2 (average) => we use z_pf = z_avg = summ_k / (niter+1)
263 
264  if (s->opt->algorithm == 1) {
265  // *** LAST z in stopping criteria ***
266 
267  switch (prob_case){
268  case 1:
269  vector_sub(s->A_z,s->b_ub_hat,s->pf_vec,M); // (A*z) - b_ub_hat
270  vector_sub(s->b_lb_hat,s->A_z,&s->pf_vec[M],M); // b_ub_hat - (A*z)
271  vector_max_with_zero(s->pf_vec, s->info->pf_vec_length); // Projection: max(ANS,0)
272  break;
273  case 2:
274  vector_sub(s->A_z,s->b_ub_hat,s->pf_vec,M); // (A*z) - b_ub_hat
275  // NOTE: No projection
276  break;
277  case 3:
278  vector_sub(s->A_z,s->b_ub_hat,s->pf_vec,M); // (A*z) - b_ub_hat
279  vector_max_with_zero(s->pf_vec, s->info->pf_vec_length); // Projection: max(ANS,0)
280  break;
281  case 4:
282  vector_sub(s->b_lb_hat,s->A_z,s->pf_vec,M); // (A*z) + b_ub_hat
283  vector_max_with_zero(s->pf_vec, s->info->pf_vec_length); // Projection: max(ANS,0)
284  break;
285  default:
286  ERROR("Error deciding the problem case\n");
287  return -1;
288  }
289  }
290  else if (s->opt->algorithm == 2) {
291  // *** AVERAGE z in pf stopping criteria ***
292 
293  vector_add(s->summ,s->z,s->summ,N); // summ += z
294  vector_scalar_mul(s->summ,1.0/(1+niter),s->z_avg,N); // z_avg = summ / (niter+1)
295  mtx_vec_mul(s->prob->A,s->z_avg,s->temp2_dim_M,M,N); // A * z_pf
296 
297  switch (prob_case){
298  case 1:
299  vector_sub(s->temp2_dim_M,s->b_ub_hat,s->pf_vec,M); // (A*z) - b_ub_hat
300  vector_sub(s->b_lb_hat,s->temp2_dim_M,&s->pf_vec[M],M); // b_ub_hat - (A*z)
301  vector_max_with_zero(s->pf_vec, s->info->pf_vec_length); // Projection: max(ANS,0)
302  break;
303  case 2:
304  vector_sub(s->temp2_dim_M,s->b_ub_hat,s->pf_vec,M); // (A*z) - b_ub_hat
305  // NOTE: No projection
306  break;
307  case 3:
308  vector_sub(s->temp2_dim_M,s->b_ub_hat,s->pf_vec,M); // (A*z) - b_ub_hat
309  vector_max_with_zero(s->pf_vec, s->info->pf_vec_length); // Projection: max(ANS,0)
310  break;
311  case 4:
312  vector_sub(s->b_lb_hat,s->temp2_dim_M,s->pf_vec,M); // (A*z) + b_ub_hat
313  vector_max_with_zero(s->pf_vec, s->info->pf_vec_length); // Projection: max(ANS,0)
314  break;
315  default:
316  ERROR("Error deciding the problem case\n");
317  return -1;
318  }
319  }
320  else {
321  ERROR("Choose algorithm 1 or 2 when running DGM()\n");
322  return -1;
323  }
324 
325  // Take the norm
326  pf = vector_norm_2(s->pf_vec, s->info->pf_vec_length); // norm2
327 
328  // store the result of the stopping criterias
329  insertArray(&ds_array, dual_value_diff);
330  insertArray(&pf_array, pf);
331 
332  /* *********************************************************************
333  Update the variables
334  ********************************************************************* */
335 
336  niter++;
337 
338  } /* #### END WHILE-LOOP #### */
339 
340  /* *********************************************************************
341  Setting the result
342  ********************************************************************* */
343 
344  // Clock
345  toc = clock();
346  s->res->out->time = (real_t)(toc - tic) / CLOCKS_PER_SEC;
347  s->res->out->time_tot_inner /= CLOCKS_PER_SEC;
348 
349  if (s->opt->algorithm == 1) {
350  s->res->zopt = s->z;
351  s->res->fopt = obj(s->z, s->prob->H, s->prob->c, s->temp1_dim_N);
352  }
353  else if (s->opt->algorithm == 2) {
354  s->res->zopt = s->z_avg;
355  s->res->fopt = obj(s->z_avg, s->prob->H, s->prob->c, s->temp1_dim_N);
356  }
357  else {
358  ERROR("Choose algorithm 1 or 2 when running DGM()\n");
359  return -1;
360  }
361 
362  s->res->lambda1 = s->lambda1;
363  s->res->lambda2 = s->lambda2;
364  s->res->out->iterations = --niter;
365  s->res->out->iterations_inner_tot = niter_inner;
366  s->res->out->niter_feasible_ds = ++niter_feasible_ds;
367  s->res->out->niter_feasible_pf = ++niter_feasible_pf;
368 
369  if (last_eps_ds == 1)
370  s->res->out->flag_last_satisfied = 2;
371  else
372  s->res->out->flag_last_satisfied = 1;
373 
374  // Copy ds_vector and pf_vector
375  s->res->out->ds_vector = (real_t *)realloc(s->res->out->ds_vector, (niter) * sizeof(real_t));
376  s->res->out->pf_vector = (real_t *)realloc(s->res->out->pf_vector, (niter) * sizeof(real_t));
377  vector_copy(ds_array.array,s->res->out->ds_vector,niter);
378  vector_copy(pf_array.array,s->res->out->pf_vector,niter);
379  freeArray(&ds_array);
380  freeArray(&pf_array);
381 
382  return 0;
383 }
384 
385 
386 /* Definition of static functions */
387 
388 static real_t dual_obj(struct Struct_DGM *s, const uint32_t prob_case)
389 {
390  /*return: 0.5z'Hz + c'z + lambda1'*(A*z - b_ub_hat) + lambda2'*(-A*z + b_lb_hat) */
391 
392  // f_value = 0.5*z'Hz + c'z;
393  real_t f_value = obj(s->z, s->prob->H, s->prob->c, s->temp1_dim_N);
394 
395  switch (prob_case){
396  case 1:
397  // f_value += lambda1'*(A*z-b-ub_hat)
398  vector_sub(s->A_z,s->b_ub_hat,s->temp3_dim_M,M); // ANS - b_ub_hat
399  f_value += vector_mul(s->lambda1,s->temp3_dim_M,M);
400 
401  // f_value += lambda2'*(-A*z+b+lb_hat)
402  vector_sub(s->b_lb_hat,s->A_z,s->temp3_dim_M,M); // b_lb_hat - (Az)
403  f_value += vector_mul(s->lambda2,s->temp3_dim_M,M);
404  break;
405  case 2:
406  // f_value += lambda1'*(A*z-b-ub_hat)
407  vector_sub(s->A_z,s->b_ub_hat,s->temp3_dim_M,M); // ANS - b_ub_hat
408  f_value += vector_mul(s->lambda1,s->temp3_dim_M,M);
409  break;
410  case 3:
411  // f_value += lambda1'*(A*z-b-ub_hat)
412  vector_sub(s->A_z,s->b_ub_hat,s->temp3_dim_M,M); // ANS - b_ub_hat
413  f_value += vector_mul(s->lambda1,s->temp3_dim_M,M);
414  break;
415  case 4:
416  // f_value += lambda2'*(-A*z+b+lb_hat)
417  vector_sub(s->b_lb_hat,s->A_z,s->temp3_dim_M,M); // b_lb_hat - (Az)
418  f_value += vector_mul(s->lambda2,s->temp3_dim_M,M);
419  break;
420  default:
421  ERROR("Error deciding the problem case\n");
422  return -1;
423  }
424 
425  return f_value;
426 }
427 
428 static void init_inner_problem(const struct Struct_DGM *s, struct Struct_FGM *p_in)
429 {
430  // Setting the inner problem to point to the outer problem except for c and z0
431  // Setting the inner problem to point to the same as the outer saves some memory
432  p_in->H = s->prob->H;
433  p_in->lb = s->prob->lb;
434  p_in->ub = s->prob->ub;
435  p_in->lb_is_inf = s->info->lb_is_inf;
436  p_in->ub_is_inf = s->info->ub_is_inf;
437  p_in->eigH_max = s->info->eigH_max;
438  p_in->eigH_min = s->info->eigH_min;
439 
440  // Make own allocation for c (This is changing for each outer iteration)
441  p_in->c = vector_alloc(N);
442  // Copy z0
443  p_in->z0 = vector_alloc(N);
444 
445  // Allocate other necessary vectors
446  p_in->zopt = vector_alloc(N);
447  p_in->z = vector_alloc(N);
448  p_in->y = vector_alloc(N);
449  p_in->znew = vector_alloc(N);
450  p_in->ynew = vector_alloc(N);
451  p_in->temp1_dim_N = vector_alloc(N);
452 
453  // Initialize options
454  //p_in->opt = malloc(sizeof * p_in->opt);
455  p_in->maxiter = s->opt->maxiter_inner;
456  p_in->eps = s->opt->eps_inner;
457 }
458 
459 static void clean_up_inner_problem(struct Struct_FGM *s)
460 {
461  free_pointer(s->c);
462  free_pointer(s->z0);
463  free_pointer(s->zopt);
464  free_pointer(s->z);
465  free_pointer(s->y);
466  free_pointer(s->znew);
467  free_pointer(s->ynew);
469 }
void vector_add(const real_t *v1, const real_t *v2, real_t *res, const uint32_t length)
real_t * lambda2
Definition: qp_structs.h:69
real_t * temp3_dim_M
Definition: dgm.h:33
void free_pointer(real_t *pointer)
real_t time_tot_inner
Definition: qp_structs.h:54
void insertArray(struct Array *a, real_t element)
real_t abs_2(const real_t a)
unsigned int uint32_t
Definition: typedefs.h:19
real_t time
Definition: qp_structs.h:53
real_t * b_ub_hat
Definition: dgm.h:34
real_t * A_t
Definition: qp_structs.h:19
uint32_t algorithm
Definition: qp_structs.h:34
real_t * lambda2
Definition: dgm.h:30
#define _DEBUG(fmt, args...)
Definition: head.h:41
real_t eigH_min
Definition: fgm.h:37
real_t obj(const real_t *z, const real_t *H, const real_t *c, real_t *temp)
boolean ub_is_inf
Definition: fgm.h:35
void vector_min(const real_t *v1, const real_t *v2, real_t *res, const uint32_t length)
void initArray(struct Array *a, uint32_t initialSize)
real_t * vector_alloc(uint32_t size)
real_t Ld
Definition: qp_structs.h:45
struct Output * out
Definition: qp_structs.h:70
real_t * temp1_dim_N
Definition: dgm.h:31
boolean ub_is_inf
Definition: qp_structs.h:40
real_t * zopt
Definition: qp_structs.h:65
uint32_t iterations_inner_tot
Definition: qp_structs.h:52
real_t * z
Definition: dgm.h:28
real_t * ub
Definition: fgm.h:25
struct Result * res
Definition: dgm.h:25
real_t * z_avg
Definition: dgm.h:36
real_t * lb
Definition: qp_structs.h:23
real_t * temp1_dim_N
Definition: fgm.h:44
real_t * znew
Definition: fgm.h:42
real_t * ds_vector
Definition: qp_structs.h:60
uint32_t exitflag
Definition: qp_structs.h:67
uint32_t flag_last_satisfied
Definition: qp_structs.h:55
real_t eps
Definition: fgm.h:48
real_t * A_z
Definition: dgm.h:39
real_t * lb
Definition: fgm.h:24
real_t * y
Definition: fgm.h:41
real_t eigH_max
Definition: fgm.h:36
uint32_t pf_vec_length
Definition: qp_structs.h:47
real_t eps_ds
Definition: qp_structs.h:31
real_t * H
Definition: qp_structs.h:16
real_t fopt
Definition: qp_structs.h:66
uint32_t iterations
Definition: qp_structs.h:51
real_t * H
Definition: fgm.h:22
struct Options * opt
Definition: dgm.h:23
boolean lb_is_inf
Definition: fgm.h:34
uint32_t exitflag
Definition: fgm.h:31
real_t * A
Definition: qp_structs.h:18
real_t * ub
Definition: qp_structs.h:24
uint32_t maxiter_outer
Definition: qp_structs.h:29
void vector_sub(const real_t *v1, const real_t *v2, real_t *res, const uint32_t length)
real_t * b_lb_hat
Definition: dgm.h:35
real_t * pf_vec
Definition: dgm.h:38
uint32_t FGM(struct Struct_FGM *s)
Definition: fgm.c:12
signed int int32_t
Definition: typedefs.h:15
struct Problem * prob
Definition: dgm.h:22
void vector_max_with_zero(real_t *v, const uint32_t length)
uint32_t niter_feasible_pf
Definition: qp_structs.h:57
real_t * lambda1
Definition: qp_structs.h:68
real_t vector_norm_2(real_t *v, const uint32_t length)
uint32_t M
Definition: head.h:34
int32_t DGM(struct Struct_DGM *s)
Definition: dgm.c:20
uint32_t num_exceeded_max_niter_inner
Definition: qp_structs.h:59
real_t * lambda1
Definition: dgm.h:29
void vector_copy(const real_t *v1, real_t *v2, const uint32_t length)
real_t eps_inner
Definition: qp_structs.h:33
real_t * z
Definition: fgm.h:40
float64_t real_t
Definition: typedefs.h:25
uint32_t exitflag_inner
Definition: qp_structs.h:58
boolean lb_is_inf
Definition: qp_structs.h:39
real_t * temp2_dim_M
Definition: dgm.h:32
real_t * summ
Definition: dgm.h:37
Definition: dgm.h:20
void vector_scalar_mul(const real_t *v1, const real_t scalar, real_t *res, const uint32_t length)
void mtx_vec_mul(const real_t *mtx, const real_t *v, real_t *res, const uint32_t rows, const uint32_t cols)
real_t * ynew
Definition: fgm.h:43
#define _SDEBUG(fmt)
Definition: head.h:60
real_t * z0
Definition: fgm.h:26
uint32_t maxiter_inner
Definition: qp_structs.h:30
real_t * z0
Definition: qp_structs.h:25
real_t * c
Definition: fgm.h:23
void vector_max(const real_t *v1, const real_t *v2, real_t *res, const uint32_t length)
real_t * ub_hat
Definition: qp_structs.h:22
real_t eigH_min
Definition: qp_structs.h:44
uint32_t problem_case
Definition: qp_structs.h:46
#define ERROR(fmt)
Definition: head.h:54
struct Info * info
Definition: dgm.h:24
real_t * pf_vector
Definition: qp_structs.h:61
#define _DEBUG2(fmt, args...)
Definition: head.h:46
real_t eps_pf
Definition: qp_structs.h:32
real_t eigH_max
Definition: qp_structs.h:43
uint32_t maxiter
Definition: fgm.h:47
uint32_t niter_feasible_ds
Definition: qp_structs.h:56
Definition: fgm.h:20
real_t * lb_hat
Definition: qp_structs.h:21
void freeArray(struct Array *a)
real_t vector_mul(const real_t *v1, const real_t *v2, const uint32_t length)
real_t * zopt
Definition: fgm.h:29
real_t * b
Definition: qp_structs.h:20
uint32_t N
Definition: head.h:33
real_t * c
Definition: qp_structs.h:17