/* This is -*- C -*- code ! */ /* ************************************************************ file 'mip.h' utility functions for MIP related routines Copyright 2004/01 Joao Pedro Pedroso, DCC-FC and LIACC Universidade do Porto, Portugal http://www.ncc.up.pt/~jpp/mipts/mip.h ************************************************************ */ #ifndef mip_h #define mip_h #include #include #include #include #include #include #include long int lround(double x); // should not be necessary, but seems to lack in math.h #include "glpk.h" #define Infinity 9.99e99; // // some utility functions // #define min(a___, b___) (a___b___ ? a___ : b___ ) // // utilities related to randomization // // random number in [0,1] with uniform distribution: double uniform(); // place the elements of a vector in random order void random_shuffle(int vector[], int size); // obtain a random permutation of the numbers 0,1,2,3,...,size-1 void permutation(int vector[], int size); // // CPU information // // cpu time since the begin of the program, in seconds: double get_cpu(); // // printing utility functions // void reportsol(double z, double zeta); void printivectz(int x[], int len, double z, double zeta); // // a structure to keep an instance's data // typedef struct lpprob { LPX *lp; LPX *art; // the same problem, with artificial variables int nints; // (redundant); number of integer variables int nvars; // (redundant); (total) number of variables int ncons; // (redundant); (total) number of constraints int *idx; // binding from lp index -> int index int *lpi; // binding from int index -> lp index int *lb; // variable's lower bound int *ub; // variable's upper bound } LPPROB; // // structure to keep control parameters // typedef struct param { int randseed; // seed for random number generation int niter; // number of tabu iterations to perform int tenure; // tabu tenure int ndivers; // (counter) iterations for diversification int nintens; // (counter) iterations for intensification } PARAM; // // mip-related function prototypes // double eval_lp_sum(LPX *lp); void solvelp(LPPROB *prob, double *z, double *zeta); void initprob(char *modfile, char *datfile, LPPROB *prob); void delprob(LPPROB *prob); void update_sol(LPPROB *prob, int x[], double *z, double *zeta, int xnew[], double znew, double zetanew); void roundfix(LPPROB *prob, int x[], double *z, double *zeta, int p[], int size); void construct(LPPROB *prob, int x[], double *z, double *zeta); #endif /* mip_h */