Skip to content

Commit

Permalink
Fix undocumented behavior when x and y are not warm started together
Browse files Browse the repository at this point in the history
  • Loading branch information
bstellato committed May 17, 2018
1 parent c43a37b commit 47043fe
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/osqp.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ OSQPWorkspace* osqp_setup(const OSQPData *data, OSQPSettings *settings) {
work->z_prev = c_calloc(work->data->m, sizeof(c_float));
work->y = c_calloc(work->data->m, sizeof(c_float));

// Initialize variables x, y, z to 0
cold_start(work);

// Primal and dual residuals variables
work->Ax = c_calloc(work->data->m, sizeof(c_float));
work->Px = c_calloc(work->data->n, sizeof(c_float));
Expand Down Expand Up @@ -898,9 +901,6 @@ c_int osqp_warm_start_x(OSQPWorkspace *work, const c_float *x) {
// Compute Ax = z and store it in z
mat_vec(work->data->A, work->x, work->z, 0);

// Cold start y
vec_set_scalar(work->y, 0., work->data->m);

return 0;
}

Expand All @@ -917,10 +917,6 @@ c_int osqp_warm_start_y(OSQPWorkspace *work, const c_float *y) {
vec_mult_scalar(work->y, work->scaling->c, work->data->m);
}

// Cold start x and z
vec_set_scalar(work->x, 0., work->data->n);
vec_set_scalar(work->z, 0., work->data->m);

return 0;
}

Expand Down

0 comments on commit 47043fe

Please sign in to comment.