Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Key data structures are in `include/types.h`: `DAQPProblem` (problem data), `DAQ
The typical call sequence is:
1. `setup_daqp(qp, work, ...)` — allocate workspace and factor the Hessian
2. `daqp_solve(res, work)` — run the solver
3. Optionally call `setup_daqp_bnb` / `setup_daqp_hiqp` / `setup_daqp_avi` before step 2 for specialized variants
3. Optionally call `setup_daqp_bnb` / `setup_daqp_hiqp` before step 2 for specialized variants (AVIs are selected by setting `qp->problem_type = 1` before `setup_daqp`)

## Conventions

Expand Down
2 changes: 1 addition & 1 deletion codegen/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void render_daqp_workspace(DAQPWorkspace* work, const char *fname, const char *d
strcat(hguard, "_H");
char *s = hguard;
while(*s){
*s = toupper((unsigned char) *s);
*s = (char)toupper((unsigned char) *s);
s++;
}
fprintf(fh, "#ifndef %s\n", hguard);
Expand Down
2 changes: 0 additions & 2 deletions include/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ int setup_daqp_main(DAQPProblem *qp, DAQPWorkspace* work, c_float* setup_time, i
int setup_daqp_ldp(DAQPWorkspace *work, DAQPProblem* qp, const int init_mask);
void setup_daqp_hiqp(DAQPWorkspace *work, int* break_points, int nh);
int setup_daqp_bnb(DAQPWorkspace* work, int* sense, int nb, int ns);
int setup_daqp_avi(DAQPAVI* avi, DAQPProblem* p, DAQPWorkspace* work, c_float* setup_time);

void allocate_daqp_settings(DAQPWorkspace *work);
void allocate_daqp_workspace(DAQPWorkspace *work, int n, int ns);
Expand All @@ -58,7 +57,6 @@ void daqp_extract_result(DAQPResult* res, DAQPWorkspace* work);
// result of the original problem, and carry its working set over to the
// original constraints
void daqp_eq_expand(DAQPResult* res, DAQPWorkspace* work);
void daqp_extract_active_duals(DAQPResult* res, DAQPWorkspace* work);
void daqp_default_settings(DAQPSettings *settings);
void daqp_minrep(int* is_redundant, c_float* A, c_float* b, int n, int m, int ms);
int daqp_first_violating(c_float* x, c_float* A, c_float* bu, c_float* bl, int n, int m, int ms, c_float tol);
Expand Down
2 changes: 0 additions & 2 deletions include/factorization.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ extern "C" {
#include "types.h"
#include "constants.h"

c_float daqp_dot(const c_float* v1, const c_float* v2, const int n);

static inline c_float daqp_dot_inline(const c_float* v1, const c_float* v2, const int n) {
c_float sum = 0.0;
for (int i = 0; i < n; i++) sum += v1[i] * v2[i];
Expand Down
10 changes: 1 addition & 9 deletions src/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ int setup_daqp_main(DAQPProblem* qp, DAQPWorkspace *work, c_float* setup_time, i
if(qp->nh > 1){
ns = 0; // Reset
int start = 0;
for(int i = 0; i < qp->nh; i++){
for(i = 0; i < qp->nh; i++){
ns = (ns > qp->break_points[i]-start) ? ns : qp->break_points[i]-start;
start = qp->break_points[i];
}
Expand Down Expand Up @@ -559,14 +559,6 @@ void daqp_extract_result(DAQPResult* res, DAQPWorkspace* work){
res->nodes = work->outer_iter;
}

void daqp_extract_active_duals(DAQPResult* res, DAQPWorkspace* work){
int i;
if(res->lam == NULL) return;
for(i=0;i<work->m;i++) res->lam[i] = 0;
for(i=0;i<work->n_active;i++)
res->lam[work->WS[i]] = work->lam_star[i];
}

void daqp_default_settings(DAQPSettings* settings){
settings->primal_tol = DAQP_DEFAULT_PRIM_TOL;
settings->dual_tol = DAQP_DEFAULT_DUAL_TOL;
Expand Down
4 changes: 0 additions & 4 deletions src/factorization.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ static c_float dot_row(const c_float* a, const c_float* b, const int n){
return (s0+s1)+(s2+s3);
}

c_float daqp_dot(const c_float* v1, const c_float* v2, const int n) {
return daqp_dot_inline(v1, v2, n);
}

void daqp_update_LDL_add(DAQPWorkspace *work, const int add_ind, const c_float rho){
work->sing_ind = DAQP_EMPTY_IND;
int i,j,disp,id;
Expand Down
4 changes: 1 addition & 3 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,6 @@ void daqp_minrep_work(int* is_redundant, DAQPWorkspace* work){
reset_daqp_workspace(work);
work->sense[i] = 5;
daqp_add_constraint(work,i,1.0);
//work->dupper[i] += tol_weak; TODO support weaky infeasible constraints
exitflag = daqp_ldp(work);
if(exitflag== DAQP_EXIT_INFEASIBLE){
is_redundant[i] = 1;
Expand All @@ -1041,7 +1040,6 @@ void daqp_minrep_work(int* is_redundant, DAQPWorkspace* work){
for(j=0; j < work->n_active; j++) // all active constraint must also be nonredundant
is_redundant[work->WS[j]] = 0;
}
// work->dupper[i] -= tol_weak; // TODO support weakly infeasible constraints
daqp_deactivate_constraints(work);
}
}
Expand Down Expand Up @@ -1092,7 +1090,7 @@ double get_time(DAQPtimer *timer){
struct timespec diff;
if ((timer->stop.tv_nsec - timer->start.tv_nsec) < 0) {
diff.tv_sec = timer->stop.tv_sec - timer->start.tv_sec - 1;
diff.tv_nsec = 1e9 + timer->stop.tv_nsec - timer->start.tv_nsec;
diff.tv_nsec = 1000000000L + timer->stop.tv_nsec - timer->start.tv_nsec;
} else {
diff.tv_sec = timer->stop.tv_sec - timer->start.tv_sec;
diff.tv_nsec = timer->stop.tv_nsec - timer->start.tv_nsec;
Expand Down
Loading