-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmnd.h
77 lines (58 loc) · 1.64 KB
/
cmnd.h
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
/*
* cmnd.h, by Marius Posta, 2009.
* Check LICENSE.txt for the legal blah-blah.
*
* Capacitated Multicommodity Network Design problem instance structure definition.
*/
#ifndef CMND_H
#define CMND_H
#include <math.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <float.h>
#ifndef INFINITY
#define INFINITY DBL_MAX
#endif
static const double inf = INFINITY;
typedef uint8_t IPC_header_t;
static const IPC_header_t IPC_error = 0;
static const IPC_header_t IPC_nothing = 1;
static const IPC_header_t IPC_end_search = 2;
static const IPC_header_t IPC_new_z_ub = 3;
static const IPC_header_t IPC_design = 4;
static const IPC_header_t IPC_solution = 5;
typedef struct
{
char name[256];
int n_nodes;
int n_arcs;
int n_commods;
// arc attributes
int* arc_orig_node;
int* arc_dest_node;
double* arc_capacity;
double* arc_fcost; // fixed cost
double** arc_commod_ucost; // unit cost
double** arc_commod_bound; // min(arc capacity, commodity supply)
// commodity attributes
int* commod_orig_node; // source
int* commod_dest_node; // sink
double* commod_supply;
double* commod_overflow_ucost; // unit cost of artificial arc linking source to sink (unit cost = bigM, fixed cost = 0, capacity = inf)
// node attributes
int* node_n_outgoing_arcs;
int* node_n_ingoing_arcs;
int** node_outgoing_arc;
int** node_ingoing_arc;
double** node_commod_supply; // +supply if source, -supply if sink, 0 otherwise
// statistical info
double avg_arc_fcost;
double min_arc_fcost;
double max_arc_fcost;
} cmnd_t;
cmnd_t cmnd_create (char* filename);
void cmnd_destroy (cmnd_t* inst);
#endif