Sha256: 0d594eb4d702b8f85b6ec7a30290c693dcb562a0b09d4dad23e0f30976805fc5

Contents?: true

Size: 838 Bytes

Versions: 4

Compression:

Stored size: 838 Bytes

Contents

#include "rw.h"
#include "scs.h"
#include "util.h"

#define OPT (1.530897)

static const char *small_random_socp(void) {
  ScsData *d;
  ScsCone *k;
  ScsSolution *sol;
  ScsInfo info = {0};
  scs_int exitflag, success;
  scs_float perr, derr;
  const char *filename = "test/data/small_random_socp";

  SCS(read_data)(filename, &d, &k);
  sol = scs_calloc(1, sizeof(ScsSolution));
  exitflag = scs(d, k, sol, &info);

  perr = SCS(dot)(d->c, sol->x, d->n) - OPT;
  derr = -SCS(dot)(d->b, sol->y, d->m) - OPT;

  scs_printf("primal obj error %4e\n", perr);
  scs_printf("dual obj error %4e\n", derr);

  success = ABS(perr) < 1e-4 && ABS(derr) < 1e-4 && exitflag == SCS_SOLVED;

  SCS(free_data)(d, k);
  SCS(free_sol)(sol);
  mu_assert("small_random_socp: SCS failed to produce outputflag SCS_SOLVED",
            success);
  return 0;
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
scs-0.2.3 vendor/scs/test/problems/small_random_socp.h
scs-0.2.2 vendor/scs/test/problems/small_random_socp.h
scs-0.2.1 vendor/scs/test/problems/small_random_socp.h
scs-0.2.0 vendor/scs/test/problems/small_random_socp.h