-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVNS.h
89 lines (52 loc) · 1.89 KB
/
VNS.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
77
78
79
80
81
82
83
84
85
86
87
88
89
#include "HLCio/dataframe.h"
#ifndef H_VNS
#define H_VNS
typedef DF_ELEMENT OPT_VAL;
typedef DF_ELEMENT POLICY;
typedef DF_ELEMENT NEIGHBORHOOD;
typedef POLICY* (*NEIGHBORHOOD_STRUCT)();
typedef POLICY* (**NEIGHBORHOOD_STRUCTURES)();
typedef POLICY (*LOCAL_SEARCH)();
typedef struct LOCAL_SEARCH_RESULT{
POLICY bx; // neighborhood structure optimal policy
int k; // neighborhood structure index
}LOCAL_SEARCH_RESULT;
typedef struct VNS_RESULT{
POLICY policy;
OPT_VAL opt_val;
}VNS_RESULT;
// OBJECTIVE FUNCTION :
typedef OPT_VAL (*OPT_FUNC)(POLICY);
// OPTIMALITY CONDITION :
typedef CMP_RESULT (*CMP_OPTIMALITY)(POLICY, POLICY, int, int);
// VNS CONFIG STRUCT :
typedef struct VNS_CONFIG{
OPT_FUNC f;
CMP_OPTIMALITY cmp_optimality;
LOCAL_SEARCH local_search;
int STOCHASTIC_LR_FAILURE_LIMIT;
DATAFRAME *ds;
int* other_params;
}VNS_CONFIG;
extern VNS_CONFIG vns_config;
// ESSENTIAL FUNCTIONS :
// neighborhood structures :
POLICY* block_swapping(POLICY, int, int, int);
POLICY* block_reversing(POLICY, int, int);
POLICY* __block_swapping(POLICY, int, int, int);
POLICY* __block_reversing(POLICY, int, int);
LOCAL_SEARCH_RESULT change_neighborhood(POLICY, POLICY, int);
NEIGHBORHOOD_STRUCTURES neistructs(int);
// DETERMINISTIC LOCAL SEARCH FUNCTIONS :
POLICY best_improvement(POLICY, NEIGHBORHOOD_STRUCT);
POLICY first_improvement(POLICY, NEIGHBORHOOD_STRUCT);
// STOCHASTIC LOCAL SEARCH :
POLICY stochastic_hill_climbing(POLICY, NEIGHBORHOOD_STRUCT);
// VARIABLE NEIGHBORHOOD SEARCH :
// VARIABLE NEIGHBORHOOD DESCENT :
POLICY VND(POLICY, NEIGHBORHOOD_STRUCTURES, int);
// GENERAL VARIABLE NEIGHBORHOOD SEARCH :
POLICY GVNS(POLICY, NEIGHBORHOOD_STRUCTURES, NEIGHBORHOOD_STRUCTURES, int, int, int);
// free VNS config :
void fVNS();
#endif