Dip  0.92.4
Classes | Macros | Typedefs | Functions
mcknap.h File Reference
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <stdarg.h>
#include <math.h>
#include <string.h>
#include <limits.h>
#include <memory.h>
#include <sys/times.h>
#include <unistd.h>
Include dependency graph for mcknap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  partvect
 
struct  itemrec
 
struct  itemset
 
struct  partset
 
struct  isetset
 
struct  ordrec
 
struct  ordintv
 
struct  ordstack
 
struct  solrec
 
struct  solstruct
 
struct  allinfo
 

Macros

#define MCKNAP_RC_OK   0
 
#define MCKNAP_RC_INF   1
 
#define MCKNAP_RC_TRIVIAL_MAXSUM   2
 
#define TRACELEVEL   10 /* level of debug information */
 
#define START   1 /* first test to be run */
 
#define TESTS   100 /* last test to be run */
 
#define _INCLUDE_POSIX_SOURCE
 
#define srand(x)   srand48(x)
 
#define random(x)   (lrand48() % (x))
 
#define SYNC   5 /* when to switch to linear scan in binary scan */
 
#define MEDIMAX   15
 
#define MAXSTACK   100
 
#define MAXLIST   32
 
#define MAXVTYPE   ULONG_MAX
 
#define TRUE   1
 
#define FALSE   0
 
#define MAXIMIZE   1
 
#define MINIMIZE   0
 
#define DET(a1, a2, b1, b2)   ((a1) * (stype) (b2) - (a2) * (stype) (b1))
 
#define SWAPS(a, b)   { register itemset t; t=*(a); *(a)=*(b); *(b)=t; }
 
#define SWAPI(a, b)   { register itemrec t; t=*(a); *(a)=*(b); *(b)=t; }
 
#define SWAPO(a, b)   { register ordrec t; t=*(a); *(a)=*(b); *(b)=t; }
 
#define SIZE(a)   ((int) (((a)->lset+1)-(a)->fset))
 
#define DEBUG(x)
 

Typedefs

typedef int boolean
 
typedef int ntype
 
typedef int itype
 
typedef double stype
 
typedef unsigned long vtype
 
typedef int(* funcptr )(const void *, const void *)
 

Functions

int minmcknapSolve (int cap, isetset *head, itemrec *solRec, stype *minObj)
 
void visitems (itemset *d)
 
void inittrace (char *ext)
 

Macro Definition Documentation

#define MCKNAP_RC_OK   0

Definition at line 6 of file mcknap.h.

#define MCKNAP_RC_INF   1

Definition at line 7 of file mcknap.h.

#define MCKNAP_RC_TRIVIAL_MAXSUM   2

Definition at line 8 of file mcknap.h.

#define TRACELEVEL   10 /* level of debug information */

Definition at line 14 of file mcknap.h.

#define START   1 /* first test to be run */

Definition at line 15 of file mcknap.h.

#define TESTS   100 /* last test to be run */

Definition at line 16 of file mcknap.h.

#define _INCLUDE_POSIX_SOURCE

Definition at line 28 of file mcknap.h.

#define srand (   x)    srand48(x)

Definition at line 40 of file mcknap.h.

Referenced by UtilPerturbCost(), and UtilStringRandom().

#define random (   x)    (lrand48() % (x))

Definition at line 41 of file mcknap.h.

#define SYNC   5 /* when to switch to linear scan in binary scan */

Definition at line 46 of file mcknap.h.

#define MEDIMAX   15

Definition at line 47 of file mcknap.h.

#define MAXSTACK   100

Definition at line 48 of file mcknap.h.

#define MAXLIST   32

Definition at line 49 of file mcknap.h.

#define MAXVTYPE   ULONG_MAX

Definition at line 50 of file mcknap.h.

#define TRUE   1

Definition at line 52 of file mcknap.h.

#define FALSE   0

Definition at line 53 of file mcknap.h.

#define MAXIMIZE   1

Definition at line 55 of file mcknap.h.

#define MINIMIZE   0

Definition at line 56 of file mcknap.h.

#define DET (   a1,
  a2,
  b1,
  b2 
)    ((a1) * (stype) (b2) - (a2) * (stype) (b1))

Definition at line 58 of file mcknap.h.

#define SWAPS (   a,
 
)    { register itemset t; t=*(a); *(a)=*(b); *(b)=t; }

Definition at line 59 of file mcknap.h.

#define SWAPI (   a,
 
)    { register itemrec t; t=*(a); *(a)=*(b); *(b)=t; }

Definition at line 60 of file mcknap.h.

#define SWAPO (   a,
 
)    { register ordrec t; t=*(a); *(a)=*(b); *(b)=t; }

Definition at line 61 of file mcknap.h.

#define SIZE (   a)    ((int) (((a)->lset+1)-(a)->fset))

Definition at line 62 of file mcknap.h.

#define DEBUG (   x)

Definition at line 207 of file mcknap.h.

Typedef Documentation

typedef int boolean

Definition at line 69 of file mcknap.h.

typedef int ntype

Definition at line 70 of file mcknap.h.

typedef int itype

Definition at line 73 of file mcknap.h.

typedef double stype

Definition at line 75 of file mcknap.h.

typedef unsigned long vtype

Definition at line 76 of file mcknap.h.

typedef int(* funcptr)(const void *, const void *)

Definition at line 159 of file mcknap.h.

Function Documentation

int minmcknapSolve ( int  cap,
isetset head,
itemrec solRec,
stype minObj 
)
void visitems ( itemset d)
void inittrace ( char *  ext)