-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatoh.h
More file actions
306 lines (236 loc) · 11.7 KB
/
patoh.h
File metadata and controls
306 lines (236 loc) · 11.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
/*
---------------------------------------------------------------------
This file is part of PaToH (Partitioning Tools for Hypergraphs)
Copyright (c) 1996- Umit V. Catalyurek
---------------------------------------------------------------------
For license info, please see the README file in the main directory.
---------------------------------------------------------------------
-------------------------------------------------------------
File : patoh.h
Author : Umit V. Catalyurek
Date : June 2, 2000
-------------------------------------------------------------
Description: PaToH v3.2 Library Interface
-------------------------------------------------------------
*/
#ifndef _PATOH_V3_LIB_H_
#define _PATOH_V3_LIB_H_
#ifdef __cplusplus
extern "C" {
#endif
/* ======================= CONSTANTS ======================= */
/* ------------------- Cut Metrics -------------------*/
/* Conectivity-1 cut definition*/
#define PATOH_CONPART 1
/* netcut definition */
#define PATOH_CUTPART 2
/* ------------------- Parameter Initialization -------------------*/
#define PATOH_SUGPARAM_DEFAULT 0
#define PATOH_SUGPARAM_SPEED 1
#define PATOH_SUGPARAM_QUALITY 2
/* ------------------- Balance -------------------*/
#define PATOH_BALANCE_STRICT 0
#define PATOH_BALANCE_ADAPTIVE 1
#define PATOH_BALANCE_RELAXED 2
/* ------------------- Coarsening ------------------- */
/* -------- Visit Order -------------- */
#define PATOH_VO_CONT 0
#define PATOH_VO_RAND 1
#define PATOH_VO_SCD 2
#define PATOH_VO_SMAXNS 3
#define PATOH_VO_SMINNS 4
#define PATOH_VO_SMINNSSUM 5
#define PATOH_VO_SWEEP 6
/* -------- Matching -------------- */
#define PATOH_CRS_FF 0
#define PATOH_CRS_HCM 1
#define PATOH_CRS_PHCM 2
#define PATOH_CRS_MANDIS 3
#define PATOH_CRS_AVGDIS 4
#define PATOH_CRS_CANBERA 5
#define PATOH_CRS_ABS 6
#define PATOH_CRS_GCM 7
#define PATOH_CRS_SHCM 8
/* --------- Agglomeratives ---------*/
#define PATOH_CRS_HCC 9
#define PATOH_CRS_HPC 10
#define PATOH_CRS_ABSHCC 11
#define PATOH_CRS_ABSHPC 12
#define PATOH_CRS_CONC 13
#define PATOH_CRS_GCC 14
#define PATOH_CRS_SHCC 15
#define PATOH_CRS_FIRST_NET_MATCH (PATOH_CRS_SHCC+1)
/* --------------- Net Base Agglomeratives -------------- */
#define PATOH_CRS_NC PATOH_CRS_FIRST_NET_MATCH
#define PATOH_CRS_MNC (PATOH_CRS_FIRST_NET_MATCH+1)
/* ------------------- Inital Partitionin ------------------- */
#define PATOH_IPA_GHGP 1
#define PATOH_IPA_AGGMATCH 2
#define PATOH_IPA_BF 3
#define PATOH_IPA_BINPACK 4
#define PATOH_IPA_RANDOM1 5
#define PATOH_IPA_RANDOM2 6
#define PATOH_IPA_RANDOM3 7
#define PATOH_IPA_GHG_MAXPIN 8
#define PATOH_IPA_GHG_MAXNET 9
#define PATOH_IPA_GHG_MAXPOSGAIN 10
#define PATOH_IPA_COMP_GHGP 11
#define PATOH_IPA_GREEDY_COMP_GHGP 12
#define PATOH_IPA_ALL 13
/* ------------------- Refinement ------------------- */
#define PATOH_REFALG_NONE 0
#define PATOH_REFALG_T_BFM 1
#define PATOH_REFALG_T_FM 2
#define PATOH_REFALG_D_BFM 3
#define PATOH_REFALG_D_FM 4
#define PATOH_REFALG_BKL 5
#define PATOH_REFALG_KL 6
#define PATOH_REFALG_MLG_BFM 7
#define PATOH_REFALG_MLG_FM 8
#define PATOH_REFALG_BFMKL 9
#define PATOH_REFALG_FMKL 10
/* ------------------- Output Detail ------------------- */
#define PATOH_OD_ONLYRESTIME -1
#define PATOH_OD_NONE 0
#define PATOH_OD_LOW 1
#define PATOH_OD_MEDIUM 2
#define PATOH_OD_HIGH 3
/* ======================= TYPES ======================= */
typedef struct
{
/* ================ Miscellaneous Parameters ================ */
/* ------- general parameters ------------*/
int cuttype;
int _k;
int outputdetail; /* PATOH_OD_... */
int seed;
int doinitperm;
/* --------- net discard parameters -----------*/
int bisec_fixednetsizetrsh;
float bisec_netsizetrsh;
int bisec_partmultnetsizetrsh;
/*----------------- V-cycle parameter ----------------*/
int bigVcycle,
smallVcycle,
usesamematchinginVcycles;
/* ---------- use heap/bucket parameters ---------- */
int usebucket;
int maxcellinheap;
int heapchk_mul;
int heapchk_div;
/* ----------------- Memory Allocation Parameters ------------------*/
int MemMul_CellNet,
MemMul_Pins,
MemMul_General;
/* ================ Coarsening Parameters ================ */
int crs_VisitOrder; /* PATOH_VO_... */
int crs_alg; /* PATOH_CRS_... */
int crs_coarsento,
crs_coarsentokmult,
crs_coarsenper;
float crs_maxallowedcellwmult;
int crs_idenafter;
int crs_iden_netsizetrh;
int crs_useafter, crs_useafteralg;
/* ================ Initial Partitioning Parameters ================ */
/*--- both init part & refinement -----*/
int nofinstances;
/* -------------- initial partitioning parameters ---------------*/
int initp_alg; /* PATOH_IPA_... */
int initp_runno;
int initp_ghg_trybalance;
int initp_refalg; /* PATOH_REFALG_... */
/* ================ Refinement Parameters ================ */
int ref_alg; /* PATOH_REFALG_... */
int ref_useafter, ref_useafteralg;
int ref_passcnt,
ref_maxnegmove;
float ref_maxnegmovemult;
int ref_dynamiclockcnt;
float ref_slow_uncoarsening;
/* -------------- imbalance parameters--------------*/
int balance;
double init_imbal,
final_imbal,
fast_initbal_mult;
float init_sol_discard_mult,
final_sol_discard_mult;
/* some utility parameters that might be useful in user's application; not used by PaToH (other than parsing them in Process_Arguments) */
char allargs[8192];
char inputfilename[512];
int noofrun;
int writepartinfo;
} PaToH_Parameters;
typedef PaToH_Parameters *PPaToH_Parameters;
/* ======================= FUNCTION PROTOTYPES ======================= */
/* --- inititalization and memory functions --- */
int PaToH_Initialize_Parameters(PPaToH_Parameters pargs, int cuttype,
int SuggestByProblemType);
/* Function should return 0 if it does NOT processes the argument, any other integer means it DID process the argument */
typedef int (*SingleArgumentCallBack)(PPaToH_Parameters pargs, char *variable, char *value, int ivalue, float fvalue);
int PaToH_Process_Arguments(PPaToH_Parameters pargs, int startargc, int argc, char *argv[], SingleArgumentCallBack func);
int PaToH_Alloc(PPaToH_Parameters pargs, int _c, int _n, int _nconst,
int *cwghts, int *nwghts, int *xpins, int *pins);
int PaToH_Free(void);
/* --- partition --- */
/* Input: pargs, _c, _n, cwghts, nwghts, xpins, pins
Ouput: partvec, partweights and cut */
/* Deprecated: use PaToH_Part instead */
int PaToH_Partition(PPaToH_Parameters pargs, int _c, int _n, int *cwghts,
int *nwghts, int *xpins, int *pins, int *partvec,
int *partweights, int *cut);
/* Input: pargs, _c, _n, cwghts, nwghts, xpins, pins, partvec
Ouput: partvec, partweights and cut */
/* Deprecated: use PaToH_Part instead */
int PaToH_Partition_with_FixCells(PPaToH_Parameters pargs, int _c, int _n,
int *cwghts, int *nwghts, int *xpins,
int *pins, int *partvec, int *partweights,
int *cut);
/* Input: pargs, _c, _n, _nconst, cwghts, xpins, pins
Ouput: partvec, partweights and cut */
/* Deprecated: use PaToH_Part instead */
int PaToH_MultiConst_Partition(PPaToH_Parameters pargs, int _c, int _n,
int _nconst, int *cwghts,
int *xpins, int *pins, int *partvec,
int *partweights, int *cut);
/* Unified interface for PaToH with target part weights
_nconst > 1: calls PaToH_MultiConst_Partition (net weights discarded)
otherwise if useFixCells=1 calls PaToH_Partition_with_FixCells
otherwise calls PaTOH_Partition
Input: pargs, _c, _n, _nconst, cwghts, nwghts, xpins, pins, targetweights,
Ouput: partvec, partweights and cut
if targetweights is NULL each targetweights[i] will be assigned to
1/pargs->_k
*/
int PaToH_Part(PPaToH_Parameters pargs, int _c, int _n, int _nconst, int useFixCells,
int *cwghts, int *nwghts, int *xpins, int *pins, float *targetweights,
int *partvec, int *partweights, int *cut);
/* --- refine --- */
/* Input: pargs, _c, _n, cwghts, nwghts, xpins, pins, partvec
Ouput: partvec, partweights and cut */
int PaToH_Refine_Bisec(PPaToH_Parameters pargs, int _c, int _n,
int *cwghts, int *nwghts, int *xpins,
int *pins, int *partvec, int *partweights,
int *cut);
/* --- utility --- */
char *PaToH_VersionStr(void);
int PaToH_Print_Parameter_Abrv(void);
void PaToH_Print_Parameters(PPaToH_Parameters p);
int PaToH_Check_User_Parameters(PPaToH_Parameters pargs, int verbose);
int PaToH_Read_Hypergraph(char *filename, int *_c, int *_n, int *_nconst,
int **cwghts, int **nwghts, int **xpins, int **pins);
int PaToH_Write_Hypergraph(char *filename, int numbering, int _c, int _n, int _nconst,
int *cwghts, int *nwghts, int *xpins, int *pins);
int PaToH_Check_Hypergraph(int _c, int _n, int _nconst,
int *cwghts, int *nwghts, int *xpins, int *pins);
int PaToH_Compute_Cut(int _k, int cuttype, int _c, int _n, int *nwghts,
int *xpins, int *pins, int *partvec);
int PaToH_Compute_Part_Weights(int _k, int _c, int _nconst,
int *cwghts, int *partvec, int *partweights);
int PaToH_Compute_Part_NetWeights(int _k, int _n, int *nwghts,
int *xpins, int *pins,
int *partvec, int *partinweights);
#ifdef __cplusplus
}
#endif
#endif