00001 /*===========================================================================*/ 00002 /* */ 00003 /* This file is part of a demonstration application for use with the */ 00004 /* SYMPHONY Branch, Cut, and Price Library. This application is a solver for */ 00005 /* the Set Partitioning Problem. */ 00006 /* */ 00007 /* (c) Copyright 2005-2008 Marta Eso and Ted Ralphs. All Rights Reserved. */ 00008 /* */ 00009 /* This application was originally developed by Marta Eso and was modified */ 00010 /* Ted Ralphs (tkralphs@lehigh.edu) */ 00011 /* */ 00012 /* This software is licensed under the Common Public License. Please see */ 00013 /* accompanying file for terms. */ 00014 /* */ 00015 /*===========================================================================*/ 00016 00017 #ifndef _SPP_TYPES_H_ 00018 #define _SPP_TYPES_H_ 00019 00020 #define row_ind_type short 00021 00022 typedef struct STATISTICS { 00023 int freq; /* how many times the routine was invoked */ 00024 double time; /* how much time was spent in this routine */ 00025 }statistics; 00026 00027 typedef struct SPARSE_MATRIX { 00028 int ncol; 00029 int nrow; 00030 int *matbeg; 00031 int *matind; 00032 double *matval; 00033 }sparse_matrix; 00034 00035 typedef struct COL_ORDERED { 00036 int colnum; /* number of columns when this column 00037 ordered matrix was created */ 00038 int rownum; /* same for number of rows */ 00039 int active_colnum; /* number of cols not marked for del */ 00040 int nzcnt; /* number of nonzeros in the matrix */ 00041 int *colnames; 00042 char *col_deleted; /* a sequence of bits indicating which 00043 columns are deleted */ 00044 double *obj; /* obj function coeffs */ 00045 int *matbeg; /* pos of beginning of cols in matind */ 00046 row_ind_type *matind; /* indices of rows listed for each col */ 00047 }col_ordered; 00048 00049 typedef struct ROW_ORDERED { 00050 int rownum; /* number of rows when this row ordered 00051 matrix was created. */ 00052 int colnum; /* same for cols */ 00053 int active_rownum; /* number of rows not marked for del */ 00054 int nzcnt; /* nonzero_count */ 00055 int *rownames; 00056 char *row_deleted; /* delete bits */ 00057 int *rmatbeg; /* pos of beginning of rows in rmatind */ 00058 int *rmatind; /* indices of cols listed for each row */ 00059 }row_ordered; 00060 00061 /* define bit manipulating macros. (a,i): starting at the memory location 00062 where a points to, find bit i; the order of bits is the following: 00063 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 23 22 ... 00064 setbit sets this bit to 1; clrbit clears this bit; isset returns 0 (false) 00065 if the bit is not set, and non-zero if it is set; isclr returns 1 (true) 00066 if the bit is not set and 0 (false) if the bit is set. */ 00067 #ifndef setbit 00068 #define setbit(a,i) ((a)[(i)/BITSPERBYTE] |= 1<<((i)%BITSPERBYTE)) 00069 #define clrbit(a,i) ((a)[(i)/BITSPERBYTE] &= ~(1<<((i)%BITSPERBYTE))) 00070 #define isset(a,i) ((a)[(i)/BITSPERBYTE] & (1<<((i)%BITSPERBYTE))) 00071 #define isclr(a,i) (((a)[(i)/BITSPERBYTE] & (1<<((i)%BITSPERBYTE))) == 0) 00072 #endif 00073 00074 00075 #endif