/usr/include/spooles/BKL/BKL.h is in libspooles-dev 2.2-10build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | /* BKL.h */
#include "../BPG.h"
#include "../cfiles.h"
/*--------------------------------------------------------------------*/
/*
-------------------------------------------------------------------
the BKL object handles the block kernihan-lin family
of algorithms defined on bipartite graphs.
bpg -- bipartite graph to work with,
not free'd when BKL object is free'd
ndom -- number of domains
nseg -- number of segments
nreg -- number of regions, nreg = ndom + nseg
totweight -- total weight of the bipartite graph
npass -- # of passes made
npatch -- # of patches evaluated
nflips -- # of domain flips that were executed
nimprove -- # of improvement steps
ngaineval -- # of gain evaluations
colors -- map from regions to colors, size nreg
cweights -- array to store color weights,
cweights[0] -- separator weight
cweights[1] -- black component weight
cweights[2] -- white component weight
regwghts -- vector of region weights.
if the Graph g has vertex weights then
regwght points to its vertex weights
and is not free'd when the BKL object is free'd
else
regwghts is allocated and set to unit weights
and free'd when the BKL object is free'd
endif
alpha -- cost function parameter
cost = |S|(1 + alpha*max(|B|,|W|)/min(|B|,|W|))
created -- 95oct07, cca
modified -- 95dec07, cca
directory cleaned up, added some efficiency,
inserted exhaustive search into fidmat procedure.
-------------------------------------------------------------------
*/
typedef struct _BKL BKL ;
struct _BKL {
BPG *bpg ;
int ndom ;
int nseg ;
int nreg ;
int totweight ;
int npass ;
int npatch ;
int nflips ;
int nimprove ;
int ngaineval ;
int *colors ;
int cweights[3] ;
int *regwghts ;
float alpha ;
} ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in basics.c ----------------------------------------
------------------------------------------------------------------------
*/
/*
-----------------------
constructor
created -- 95oct07, cca
-----------------------
*/
BKL *
BKL_new (
void
) ;
/*
-----------------------
set the default fields
created -- 95oct07, cca
-----------------------
*/
void
BKL_setDefaultFields (
BKL *bkl
) ;
/*
-----------------------
clear the data fields
created -- 95oct07, cca
-----------------------
*/
void
BKL_clearData (
BKL *bkl
) ;
/*
-----------------------
destructor
created -- 95oct07, cca
-----------------------
*/
void
BKL_free (
BKL *bkl
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in init.c ------------------------------------------
------------------------------------------------------------------------
*/
/*
-----------------------
initialize the object
created -- 95oct07, cca
-----------------------
*/
void
BKL_init (
BKL *bkl,
BPG *bpg,
float alpha
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in util.c ------------------------------------------
------------------------------------------------------------------------
*/
/*
------------------------------------------------
set the colors of the domains and segments
by coloring the domains black or white randomly.
created -- 95oct07, cca
------------------------------------------------
*/
void
BKL_setRandomColors (
BKL *bkl,
int seed
) ;
/*
-----------------------------------------
set the component weights.
note, we assume the domain colors are set
created -- 95oct07, cca
-----------------------------------------
*/
void
BKL_setColorWeights (
BKL *bkl
) ;
/*
---------------------------------------
return the segment color, a function of
the colors of its neighboring domains.
created -- 95oct07, cca
---------------------------------------
*/
int
BKL_segColor (
BKL *bkl,
int iseg
) ;
/*
-----------------------
flip the domain
created -- 95oct07, cca
-----------------------
*/
void
BKL_flipDomain (
BKL *bkl,
int idom
) ;
/*
------------------------------
return the next domain to flip
in a grey code sequence
created -- 95oct07, cca
------------------------------
*/
int
BKL_greyCodeDomain (
BKL *bkl,
int count
) ;
/*
----------------------------------------------------------------
set the initial partition.
flag -- specifies initial partition type
flag == 1 --> random coloring of domains
flag == 2 --> one black domain, (seed % ndom), rest are white
flag == 3 --> one black pseudoperipheral domain, found using
domain (seed % ndom) as root, rest are white
flag == 4 --> roughly half-half split, breadth first search
of domains, (seed % ndom) as root
flag == 5 --> roughly half-half split, breadth first search
of domains, (seed % ndom) as root to find
a pseudoperipheral domain as root
flag == 6 --> use domcolors[] to seed the colors[] array
seed -- random number seed, for flag == 1, if seed > 0 then
we call srand48(seed) to set the random number
generator.
domcolors -- vector of domain colors, used when flag == 6
created -- 95oct11, cca
----------------------------------------------------------------
*/
float
BKL_setInitPart (
BKL *bkl,
int flag,
int seed,
int domcolors[]
) ;
/*
---------------------------------------------------
return 1 if the domain is adjacent to the separator
created -- 95oct11, cca
---------------------------------------------------
*/
int
BKL_domAdjToSep (
BKL *bkl,
int dom
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in exhSearch.c -------------------------------------
------------------------------------------------------------------------
*/
/*
--------------------------------------------------------------------
perform an exhaustive search over a subspace of domains
mdom -- number of domains in the subspace
domids -- vector of domain ids, size mdom
tcolors -- temporary vector to hold active domain colors, size mdom
note : region colors and component weights of the best
partition are left in bkl->colors[] and bkl->cweights[].
return value -- cost of best partition
created -- 95oct07, cca
--------------------------------------------------------------------
*/
float
BKL_exhSearch (
BKL *bkl,
int mdom,
int domids[],
int tcolors[]
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in evalfcn.c ---------------------------------------
------------------------------------------------------------------------
*/
/*
-----------------------
evaluate the partition
created -- 95oct07, cca
-----------------------
*/
float
BKL_evalfcn (
BKL *bkl
) ;
/*
-----------------------
evaluate the partition
created -- 95oct07, cca
-----------------------
*/
float
BKL_eval (
BKL *bkl,
int Sweight,
int Bweight,
int Wweight
) ;
/*
---------------------------------------------------------
evaluate the (deltaS, deltaB and deltaW) of a domain flip
created -- 950ct11, cca
---------------------------------------------------------
*/
void
BKL_evalgain (
BKL *bkl,
int dom,
int *pdeltaS,
int *pdeltaB,
int *pdeltaW
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in fidmat.c ----------------------------------------
------------------------------------------------------------------------
*/
/*
------------------------------------------------
improve the partition using the FidMat algorithm
created -- 95oct11, cca
------------------------------------------------
*/
float
BKL_fidmat (
BKL *bkl
) ;
/*--------------------------------------------------------------------*/
|