parent
ad8e20c62b
commit
67ca00a0e0
@ -1,39 +1,10 @@
|
|||||||
#ifndef __MAIN_H_
|
#ifndef _PROJECT_MAIN_H_
|
||||||
#define __MAIN_H_
|
#define _PROJECT_MAIN_H_
|
||||||
|
|
||||||
struct AdjObj
|
extern char *INPUT_FILENAME;
|
||||||
{
|
extern unsigned int SEED;
|
||||||
int n;
|
extern int GEOMETRIC_DATA;
|
||||||
/* index of neighbor node */
|
extern int NODE_COUNT_RAND;
|
||||||
int e; /* index of adj joining neighbor */
|
extern int GRID_SIZE_RAND;
|
||||||
};
|
|
||||||
|
|
||||||
struct Node
|
|
||||||
{
|
|
||||||
int deg;
|
|
||||||
struct AdjObj *adj;
|
|
||||||
int mark;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Graph
|
|
||||||
{
|
|
||||||
int node_count;
|
|
||||||
int edge_count;
|
|
||||||
struct Node *node_list;
|
|
||||||
struct AdjObj *adj_space;
|
|
||||||
};
|
|
||||||
|
|
||||||
void usage(char *f);
|
|
||||||
|
|
||||||
int parseargs(int ac, char **av);
|
|
||||||
|
|
||||||
extern char *fname;
|
|
||||||
extern int seed;
|
|
||||||
extern int geometric_data;
|
|
||||||
extern int ncount_rand;
|
|
||||||
extern int gridsize_rand;
|
|
||||||
extern int use_all_subtours;
|
|
||||||
|
|
||||||
extern double initial_time;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -1,39 +1,48 @@
|
|||||||
//
|
#ifndef _PROJECT_TSP_H_
|
||||||
// Created by isoron on 3/17/15.
|
#define _PROJECT_TSP_H_
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef ___TSP_H_
|
|
||||||
#define ___TSP_H_
|
|
||||||
|
|
||||||
#include "lp.h"
|
#include "lp.h"
|
||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
|
|
||||||
int add_all_subtours(int ncount, int ecount, int *elist, struct LP *lp);
|
struct TSPData
|
||||||
|
{
|
||||||
|
int node_count;
|
||||||
|
int edge_count;
|
||||||
|
int *edge_list;
|
||||||
|
int *edge_weights;
|
||||||
|
};
|
||||||
|
|
||||||
|
int TSP_init_data(struct TSPData *data);
|
||||||
|
|
||||||
|
void TSP_free_data(struct TSPData *data);
|
||||||
|
|
||||||
int TSP_find_violated_subtour_elimination_cut
|
int TSP_find_violated_subtour_elimination_cut
|
||||||
(int ncount, int ecount, int *elist, struct LP *lp);
|
(struct LP *lp, struct TSPData *data);
|
||||||
|
|
||||||
int TSP_is_graph_connected(
|
int TSP_is_graph_connected(
|
||||||
struct Graph *G, double *x, int *island_count, int *island_sizes,
|
struct Graph *G,
|
||||||
int *island_start, int *island_nodes);
|
double *x,
|
||||||
|
int *island_count,
|
||||||
|
int *island_sizes,
|
||||||
|
int *island_start,
|
||||||
|
int *island_nodes);
|
||||||
|
|
||||||
int TSP_find_closest_neighbor_tour(
|
int TSP_find_closest_neighbor_tour(
|
||||||
int start, int node_count, int edge_count, int *edges, int *elen,
|
int start,
|
||||||
|
int node_count,
|
||||||
|
int edge_count,
|
||||||
|
int *edges,
|
||||||
|
int *elen,
|
||||||
int *path_length);
|
int *path_length);
|
||||||
|
|
||||||
int TSP_add_subtour_elimination_cut(struct LP *lp, int deltacount, int *delta);
|
int TSP_add_subtour_elimination_cut(struct LP *lp, int delta_length, int *delta);
|
||||||
|
|
||||||
int TSP_read_problem(
|
int TSP_read_problem(char *filename, struct TSPData *data);
|
||||||
char *filename, int *p_ncount, int *p_ecount, int **p_elist,
|
|
||||||
int **p_elen);
|
|
||||||
|
|
||||||
int TSP_add_cutting_planes(int ncount, int ecount, int *elist, struct LP *lp);
|
int TSP_add_cutting_planes(struct LP *lp, struct TSPData *data);
|
||||||
|
|
||||||
int TSP_init_lp(
|
int TSP_init_lp(struct LP *lp, struct TSPData *data);
|
||||||
int node_count, struct LP *lp, int edge_count, int *edge_weights,
|
|
||||||
int *edge_list);
|
|
||||||
|
|
||||||
double TSP_find_initial_solution
|
double TSP_find_initial_solution(struct TSPData *data);
|
||||||
(int *edge_weights, int *edge_list, int node_count, int edge_count);
|
|
||||||
|
|
||||||
#endif //_PROJECT_TSP_H_
|
#endif
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
#ifndef __CO759_UTIL_H
|
#ifndef _PROJECT_UTIL_H_
|
||||||
#define __CO759_UTIL_H
|
#define _PROJECT_UTIL_H_
|
||||||
|
|
||||||
#define ABORT_IF(cond, msg) if(cond) { \
|
#define ABORT_IF(cond, msg) if(cond) { \
|
||||||
fprintf(stderr, msg); rval = 1; goto CLEANUP; }
|
fprintf(stderr, msg); rval = 1; goto CLEANUP; }
|
||||||
|
|
||||||
double util_get_current_time(void);
|
double get_current_time(void);
|
||||||
|
|
||||||
int CO759_build_xy(int ncount, double *xlist, double *ylist, int gridsize);
|
int build_random_2d_points
|
||||||
|
(int node_count, double *x_list, double *y_list, int grid_size);
|
||||||
|
|
||||||
double util_get_current_time(void);
|
double get_current_time(void);
|
||||||
|
|
||||||
void time_printf(const char *fmt, ...);
|
void time_printf(const char *fmt, ...);
|
||||||
|
|
||||||
void next_set(int sz, int *Set);
|
void next_set(int sz, int *set);
|
||||||
|
|
||||||
#endif /* __CO759_UTIL_H */
|
#endif
|
||||||
|
Reference in new issue