1 /* $Id$ $Revision$ */
2 /* vim:set shiftwidth=4 ts=8: */
3 
4 /**
5  * Authors:
6  *   Tim Dwyer <tgdwyer@gmail.com>
7  *
8  * Copyright (C) 2005 Authors
9  *
10  * This version is released under the CPL (Common Public License) with
11  * the Graphviz distribution.
12  * A version is also available under the LGPL as part of the Adaptagrams
13  * project: http://sourceforge.net/projects/adaptagrams.
14  * If you make improvements or bug fixes to this code it would be much
15  * appreciated if you could also contribute those changes back to the
16  * Adaptagrams repository.
17  */
18 
19 /**********************************************************
20 *      Written by Tim Dwyer for the graphviz package      *
21 *                http://www.graphviz.org/                 *
22 *                                                         *
23 **********************************************************/
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #ifndef _QUAD_PROG_VPSC_H_
30 #define _QUAD_PROG_VPSC_H_
31 
32 #ifdef DIGCOLA
33 
34 #include "defs.h"
35 #include "digcola.h"
36 #ifdef MOSEK
37 #include "mosek_quad_solve.h"
38 #endif /* MOSEK */
39 
40 typedef struct CMajEnvVPSC {
41 	float **A;
42 	float *packedMat;
43 	int nv;   /* number of actual vars */
44 	int nldv; /* number of dummy nodes included in lap matrix */
45 	int ndv;  /* number of dummy nodes not included in lap matrix */
46 	Variable **vs;
47 	int m; /* total number of constraints for next iteration */
48 	int gm; /* number of global constraints */
49 	Constraint **cs;
50 	/* global constraints are persistent throughout optimisation process */
51 	Constraint **gcs;
52 	VPSC *vpsc;
53 	float *fArray1; /* utility arrays - reusable memory */
54 	float *fArray2;
55 	float *fArray3;
56 #ifdef MOSEK
57 	MosekEnv *mosekEnv;
58 #endif /* MOSEK */
59 } CMajEnvVPSC;
60 
61 extern CMajEnvVPSC* initCMajVPSC(int n, float *packedMat, vtx_data* graph, ipsep_options *opt, int diredges);
62 
63 extern int constrained_majorization_vpsc(CMajEnvVPSC*, float*, float*, int);
64 
65 extern void deleteCMajEnvVPSC(CMajEnvVPSC *e);
66 extern void generateNonoverlapConstraints(
67         CMajEnvVPSC* e,
68         float nsizeScale,
69         float** coords,
70         int k,
71 	boolean transitiveClosure,
72 	ipsep_options* opt
73 );
74 
75 extern void removeoverlaps(int,float**,ipsep_options*);
76 
77 typedef struct {
78 	int *nodes;
79 	int num_nodes;
80 } DigColaLevel;
81 
82 /*
83  * unpack the "ordering" array into an array of DigColaLevel (as defined above)
84  */
85 extern DigColaLevel* assign_digcola_levels(int *ordering, int n, int *level_inds, int num_divisions);
86 extern void delete_digcola_levels(DigColaLevel *l, int num_levels);
87 extern void print_digcola_levels(FILE* logfile, DigColaLevel *levels, int num_levels);
88 int get_num_digcola_constraints(DigColaLevel *levels, int num_levels);
89 #endif
90 
91 #endif /* _QUAD_PROG_VPSC_H_ */
92 
93 #ifdef __cplusplus
94 }
95 #endif
96