SuperSCS  1.3.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
scs.h
Go to the documentation of this file.
1 /*
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2017 Pantelis Sopasakis (https://alphaville.github.io),
5  * Krina Menounou (https://www.linkedin.com/in/krinamenounou),
6  * Panagiotis Patrinos (http://homes.esat.kuleuven.be/~ppatrino)
7  * Copyright (c) 2012 Brendan O'Donoghue (bodonoghue85@gmail.com)
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a copy
10  * of this software and associated documentation files (the "Software"), to deal
11  * in the Software without restriction, including without limitation the rights
12  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13  * copies of the Software, and to permit persons to whom the Software is
14  * furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included in all
17  * copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25  * SOFTWARE.
26  *
27  */
28 #ifndef SCS_H_GUARD
29 #define SCS_H_GUARD
30 
31 #include "glbopts.h"
32 #include <string.h>
33 #include "cones.h"
34 #include "linAlg.h"
35 #include "linSys.h"
36 #include "util.h"
37 #include "ctrlc.h"
38 #include "constants.h"
39 #include <math.h>
40 #include <stdio.h>
41 #include "scs_blas.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 
48 
70  };
71 
75  struct scs_work {
249  };
250 
254  struct scs_data {
255  /* these cannot change for multiple runs for the same call to scs_init */
269  /* these can change for multiple runs for the same call to scs_init */
270 
271  /* dense arrays for b (size m), c (size n) */
272 
285  };
286 
290  struct scs_settings {
291  /* settings parameters: default suggested input */
292 
293 
294  /* -------------------------------------
295  * General Settings
296  *
297  * these *cannot* change for multiple runs
298  * with the same call to scs_init
299  * ------------------------------------- */
300 
307 
320 
321 
322  /* -------------------------------------
323  * General Settings
324  *
325  * these can change for multiple runs with
326  * the same call to scs_init
327  * ------------------------------------- */
328 
336 
381 
382  /* -------------------------------------
383  * Settings associated with SuperSCS
384  * ------------------------------------- */
385 
423 
424  /* -------------------------------------
425  * Settings associated with the line
426  * search
427  * ------------------------------------- */
447 
448  /* -------------------------------------
449  * Settings associated with the direction
450  * ------------------------------------- */
492 
513  };
514 
518  struct scs_solution {
531  };
532 
533 #define SCS_INFO_STATUS_MSG_LENGTH 32
534 
539  struct scs_info {
565  unsigned long long allocated_memory;
566  };
567 
571  struct scs_scaling {
572  scs_float *RESTRICT D, *RESTRICT E; /* for normalization */
574  };
575 
585  ScsSolution * scs_init_sol(void);
586 
594  ScsInfo * scs_init_info(void);
595 
596 
610  ScsData * scs_init_data(void);
611 
625  scs_int scs(
626  const ScsData *RESTRICT d,
627  const ScsCone *RESTRICT k,
628  ScsSolution *RESTRICT sol,
629  ScsInfo *RESTRICT info);
630 
636  const char *scs_version(void);
637 
647  void scs_millis_to_time(scs_float time,
648  scs_int * hours,
649  scs_int * minutes,
650  scs_int * secs,
651  scs_float * sec_rest);
652 
653 #ifdef __cplusplus
654 }
655 #endif
656 #endif
scs_int mem
(target/maximum/allocated) memory
Definition: scs.h:68
scs_float *RESTRICT Rwu
Vector from line search.
Definition: scs.h:180
scs_float resPri
primal equality residual
Definition: scs.h:547
scs_int statusVal
status as scs_int, defined in constants.h
Definition: scs.h:542
scs_int do_record_progress
Definition: scs.h:491
scs_float *RESTRICT h
Auxiliary variable used in projections on linear spaces.
Definition: scs.h:111
scs_int do_override_streams
Definition: scs.h:498
Terminating information.
Definition: scs.h:539
scs_int m
Row dimension of .
Definition: scs.h:79
scs_float *RESTRICT progress_relgap
relative gap history
Definition: scs.h:555
#define RESTRICT
Definition: glbopts.h:44
scs_float *RESTRICT s_b
Variable that corresponds to the primal slack for the 2nd step of DRS.
Definition: scs.h:200
scs_float cg_rate
Definition: scs.h:367
struct scs_private_data ScsPrivWorkspace
Definition: linSys.h:61
scs_int ls_wspace_length
Length of workspace used to solve Anderson's linear system.
Definition: scs.h:65
scs_float *RESTRICT c
The (possibly normalized) vector .
Definition: scs.h:142
scs_float thetabar
Definition: scs.h:464
scs_float nrmR_con
.
Definition: scs.h:184
scs_int memory
Definition: scs.h:472
scs_float *RESTRICT dir
Direction .
Definition: scs.h:154
ScsSettings *RESTRICT stgs
Definition: scs.h:284
The sparse matrix A of the conic optimization problem.
Definition: amatrix.h:44
scs_float scale
Definition: scs.h:313
scs_int do_super_scs
Definition: scs.h:386
scs_float gTh
Auxiliary variable.
Definition: scs.h:204
scs_float linsys_total_solve_time_ms
total linsys (e.g., CG) solve time in ms
Definition: scs.h:554
scs_float *RESTRICT progress_time
Timestamp of iteration.
Definition: scs.h:561
scs_float *RESTRICT R_prev
Fixed-point residual (FPR) of the previous iteration .
Definition: scs.h:150
scs_int broyden_init_scaling
Definition: scs.h:487
FILE *RESTRICT output_stream
Output stream where progress information is printed.
Definition: scs.h:512
scs_int current_mem
current memory length
Definition: scs.h:69
#define SCS_INFO_STATUS_MSG_LENGTH
Definition: scs.h:533
scs_float sc_c
Scaling factor corresponding to .
Definition: scs.h:212
scs_int max_iters
Definition: scs.h:342
void scs_millis_to_time(scs_float time, scs_int *hours, scs_int *minutes, scs_int *secs, scs_float *sec_rest)
Converts milliseconds to a 00:00:00.0 time format.
scs_float *RESTRICT dr
Dual residual vector.
Definition: scs.h:134
scs_float *RESTRICT v
Vector (used only in SCS, not in SuperSCS).
Definition: scs.h:95
scs_float * t
Solution of the linear system .
Definition: scs.h:64
scs_int verbose
Definition: scs.h:376
scs_float *RESTRICT u_prev
Vector of the previous iteration.
Definition: scs.h:103
scs_float *RESTRICT Sk
Definition: scs.h:188
scs_float stepsize
The current stepsize .
Definition: scs.h:196
scs_float *RESTRICT wu_b
Variable .
Definition: scs.h:176
enum direction_enum ScsDirectionType
Direction computation method (in SuperSCS)
scs_int history_length
how many history entries
Definition: scs.h:543
scs_int l
Dimension of , that is .
Definition: scs.h:87
ScsDirectionCache *RESTRICT direction_cache
A cache for the computation of Broyden or Anderson's acceleration.
Definition: scs.h:248
scs_int ls
Definition: scs.h:431
scs_int *RESTRICT progress_ls
Number of line search iterations.
Definition: scs.h:564
scs_int previous_max_iters
Definition: scs.h:348
scs_float *RESTRICT s
Definition: scs.h:530
scs_float sigma
Definition: scs.h:446
ScsPrivWorkspace *RESTRICT p
struct populated by linear system solver
Definition: scs.h:232
scs_float *RESTRICT u_t
Vector .
Definition: scs.h:99
scs_float *RESTRICT progress_resdual
dual residual history
Definition: scs.h:557
scs_int n
Definition: scs.h:263
scs_float max_time_milliseconds
Definition: scs.h:335
ScsConeWork *RESTRICT coneWork
workspace for the cone projection step
Definition: scs.h:244
scs_float resDual
dual equality residual
Definition: scs.h:548
unsigned long long allocated_memory
Memory, in bytes, that was allocated to run the algorithm.
Definition: scs.h:565
scs_float beta
Definition: scs.h:440
scs_float *RESTRICT x
Definition: scs.h:522
scs_float *RESTRICT progress_dcost
sclaed dual cost history
Definition: scs.h:559
scs_int k1
Definition: scs.h:404
scs_int mem_cursor
current memory cursor [0..mem-1]
Definition: scs.h:67
scs_int iter
number of iterations taken
Definition: scs.h:541
scs_float solveTime
time taken for solve phase (milliseconds)
Definition: scs.h:553
scs_float *RESTRICT H
Hessian approximation used by the full Broyden method.
Definition: scs.h:160
scs_int tRule
Definition: scs.h:480
scs_int *RESTRICT progress_iter
iterations when residulas are recorded
Definition: scs.h:562
scs_float *RESTRICT c
Definition: scs.h:280
scs_float *RESTRICT wu_t
Variable .
Definition: scs.h:172
ScsAMatrix * A
The (possibly normalized) A matrix.
Definition: scs.h:228
scs_float c1
Definition: scs.h:416
scs_int scs(const ScsData *RESTRICT d, const ScsCone *RESTRICT k, ScsSolution *RESTRICT sol, ScsInfo *RESTRICT info)
scs_float meanNormRowA
Definition: scs.h:573
scs_float *RESTRICT *RESTRICT E
Definition: scs.h:572
scs_float *RESTRICT b
The (possibly normalized) vector .
Definition: scs.h:138
scs_float dobj
dual objective
Definition: scs.h:546
int scs_int
Definition: glbopts.h:96
scs_int cg_total_iters
total CG iterations (-1 if not defined)
Definition: scs.h:544
scs_float * ls_wspace
Workspace used to solve Anderson's linear system.
Definition: scs.h:66
scs_float *RESTRICT progress_pcost
scaled primal cost history
Definition: scs.h:558
scs_float *RESTRICT u_b
Vector .
Definition: scs.h:107
scs_float kap_b
Variable for certificates of infeasibility/unboudedness.
Definition: scs.h:224
scs_int warm_start
Definition: scs.h:380
scs_float nm_b
Norm of .
Definition: scs.h:216
scs_float *RESTRICT progress_respri
primal residual history
Definition: scs.h:556
scs_float setupTime
time taken for setup phase (milliseconds)
Definition: scs.h:552
ScsSolution * scs_init_sol(void)
scs_int k0
Definition: scs.h:392
char status[SCS_INFO_STATUS_MSG_LENGTH]
status string, e.g. 'Solved'
Definition: scs.h:540
scs_float * U
cached values of , or cached values of
Definition: scs.h:62
scs_float *RESTRICT progress_norm_fpr
FPR history.
Definition: scs.h:560
scs_float sc_b
Scaling factor corresponding to .
Definition: scs.h:208
scs_float sse
Definition: scs.h:422
Cone structure.
Definition: cones.h:48
scs_float *RESTRICT g
Auxiliary variable of dimension used in projections on linear spaces.
Definition: scs.h:115
ScsInfo * scs_init_info(void)
scs_float meanNormColA
Definition: scs.h:573
scs_int *RESTRICT progress_mode
Mode of SuperSCS at each iteration.
Definition: scs.h:563
scs_float *RESTRICT R
Fixed-point residual .
Definition: scs.h:146
scs_float eps
Definition: scs.h:354
scs_float c_bl
Definition: scs.h:398
double scs_float
Definition: glbopts.h:100
scs_float resInfeas
infeasibility cert residual
Definition: scs.h:549
scs_float rho_x
Definition: scs.h:319
scs_float * S
cached values of (s-memory)
Definition: scs.h:61
scs_int m
Definition: scs.h:259
scs_float alpha
Definition: scs.h:360
scs_float nm_c
Norm of .
Definition: scs.h:220
scs_int k2
Definition: scs.h:410
struct containing problem data
Definition: scs.h:254
scs_float *RESTRICT u
Vector .
Definition: scs.h:91
scs_float *RESTRICT pr
Primal residual vector.
Definition: scs.h:125
Workspace for SCS.
Definition: scs.h:75
ScsDirectionType direction
Definition: scs.h:458
scs_float *RESTRICT wu
Variable .
Definition: scs.h:168
scs_float *RESTRICT D
Definition: scs.h:572
Memory for the computation of directions (Broyden and Anderson's methods).
Definition: scs.h:60
Settings structure.
Definition: scs.h:290
ScsData * scs_init_data(void)
ScsAMatrix * A
Definition: scs.h:268
scs_float *RESTRICT dut
Direction corresponding to .
Definition: scs.h:164
scs_int n
Column dimension of .
Definition: scs.h:83
scs_float relGap
relative duality gap
Definition: scs.h:551
scs_float pobj
primal objective
Definition: scs.h:545
Workspace for cones.
Definition: cones.h:131
scs_float * S_minus_Y
The difference (for Anderson's acceleration)
Definition: scs.h:63
scs_float *RESTRICT y
Definition: scs.h:526
scs_float *RESTRICT b
Definition: scs.h:276
scs_float *RESTRICT Yk
Definition: scs.h:192
const char * scs_version(void)
Normalization variables.
Definition: scs.h:571
scs_int normalize
Definition: scs.h:306
scs_float resUnbdd
unbounded cert residual
Definition: scs.h:550
ScsScaling *RESTRICT scal
contains the re-scaling data
Definition: scs.h:240
Primal-dual solution arrays.
Definition: scs.h:518
ScsSettings *RESTRICT stgs
contains solver settings specified by user
Definition: scs.h:236