-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.h
387 lines (358 loc) · 9.55 KB
/
global.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
#ifndef __GLOBAL_H_
#define __GLOBAL_H_
#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <memory.h>
#include <vector>
#include <cassert>
#include <algorithm>
//#include "object_mxl.h"
using namespace std;
#include "random.h"
#define PI 3.1415926535897932384626433832795
//------------- Parameters in test instance ------------------
int nvar, nobj; // the number of variables and objectives
vector<double> lowBound, uppBound; // lower and upper bounds of variables
char strTestInstance[256];
char strFunctionType[256];
int num_max_evulation;
char strCrossType[256];
//------------- Parameters in random number ------------------
int seed = 177;
long rnd_uni_init;
//------------- Parameters in MOEA/D -------------------------
vector <double> idealpoint;
vector <double> nad_point;
double scale[100];
int etax = 20, etam = 20; // distribution indexes of crossover and mutation
double realx, realm, realb = 0.9; // crossover, mutation, selection probabilities
int num_of_random =10;
int inst;
int position_parameters = 2;
int distance_parameters = 2;
int size_exter_pop;
int num_update_weight;
double evol_rate;
double start_time_exter_pop_update;
double rate_update_weight;
int preserve_radian = 4;
//------------------Parameters in Light Beam Search of NSGA-II--------------
//------------------Parameters in Light Beam Search of NSGA-II--------------
int numMultipeLightBeams = 1;
vector< vector<double> > AspirationPoint;
vector< vector<double> > ReservationPoint;
vector< vector<double> > VetoThreshold;
vector< vector<double> > Weight;
vector< vector<double> > PreferDirection;
double EpsilonDistance;
//vector<double> CorwdDistance;
//------------------Parameters for ankang reservior flood control--------------
//double lowBound = 0; //编码下限
//double uppBound = 37474; //编码上限,枢纽最大下泄流量
double ZB = 300; //水位下限
double ZU = 330; //水位上限
double V_0 = 1737250000; //初始调度水库容量
double Q_0 = 773; // 初始下泄流量
double ZFL = 325; // 偏好中心
double D = 2.0;
int NUM = 3.0;
double ZBP = ZFL - D; //***********偏好下界*********
double ZUP = ZFL + D; //***********偏好上界**********
double relaxfactor = 1.0; //删除阈值放松系数
double relaxfactor1 = 1.2; //外部种群更新阈值放松系数
double relaxfactor2 = 1.0; //增加阈值放松系数
vector<double> midpoint;
vector<double> threshold;
int T=6; //调度时间间隔6小时(入库洪水量记录间隔为1小时)
vector <double> Idata; //入库洪水量记录
vector < vector<double> > L2C;//水位库容曲线
double ref_1=330;
double ref_2=37474;
//------------------Parameters for ankang reservior flood control--------------
vector<vector<double>> TOTAL;
vector<vector<double>> HV;
//vector<double> HV ;
void xboundy(void)
{
int i =0;
if(!strcmp("UF1", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
for (i=1;i<nvar;i++)
{
lowBound[i] = -1;
uppBound[i] = 1;
}
return;
}
if(!strcmp("UF2", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
for (i=1;i<nvar;i++)
{
lowBound[i] = -1;
uppBound[i] = 1;
}
return;
}
if(!strcmp("UF3", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
return;
}
if(!strcmp("UF4", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
for (i=1;i<nvar;i++)
{
lowBound[i] = -2;
uppBound[i] = 2;
}
return;
}
if(!strcmp("UF5", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
for (i=1;i<nvar;i++)
{
lowBound[i] = -1;
uppBound[i] = 1;
}
return;
}
if(!strcmp("UF6", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
for (i=1;i<nvar;i++)
{
lowBound[i] = -1;
uppBound[i] = 1;
}
return;
}
if(!strcmp("UF7", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
for (i=1;i<nvar;i++)
{
lowBound[i] = -1;
uppBound[i] = 1;
}
return;
}
if(!strcmp("UF8", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
for (i=2;i<nvar;i++)
{
lowBound[i] = -2;
uppBound[i] = 2;
}
return;
}
if(!strcmp("UF9", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
for (i=2;i<nvar;i++)
{
lowBound[i] = -2;
uppBound[i] = 2;
}
return;
}
if(!strcmp("UF10", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
for (i=2;i<nvar;i++)
{
lowBound[i] = -2;
uppBound[i] = 2;
}
return;
}
if (!strcmp("R2_DTLZ2_M5", strTestInstance))
{
double low30[] = {-1.773, -1.846, -1.053, -2.370, -1.603, -1.878, -1.677, -0.935, -1.891, -0.964, -0.885, -1.690, -2.235, -1.541, -0.720, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000};
double upp30[] = {1.403, 1.562, 2.009, 0.976, 1.490, 1.334, 1.074, 2.354, 1.462, 2.372, 2.267, 1.309, 0.842, 1.665, 2.476, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000};
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
for (i=0;i<nvar;i++)
{
lowBound[i] = low30[i];
uppBound[i] = upp30[i];
}
return;
}
if (!strcmp("R2_DTLZ3_M5", strTestInstance))
{
double low30[] = {-1.773, -1.846, -1.053, -2.370, -1.603, -1.878, -1.677, -0.935, -1.891, -0.964, -0.885, -1.690, -2.235, -1.541, -0.720, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000};
double upp30[] = {1.403, 1.562, 2.009, 0.976, 1.490, 1.334, 1.074, 2.354, 1.462, 2.372, 2.267, 1.309, 0.842, 1.665, 2.476, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000};
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
for (i=0;i<nvar;i++)
{
lowBound[i] = low30[i];
uppBound[i] = upp30[i];
}
return;
}
//if (!strcmp("WFG1_M5", strTestInstance))
//{
// lowBound = vector<double>(nvar, 0);
// uppBound = vector<double>(nvar, 1);
// return;
//}
if (!strcmp("DTLZ1", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
return;
}
if (!strcmp("DTLZ2", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
return;
}
if (!strcmp("DTLZ3", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
return;
}
if (!strcmp("DTLZ4", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
return;
}
if (!strcmp("DTLZ7", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 1);
return;
}
if(!strcmp("WFG1", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 2);
for (i = 1; i < nvar; i++) uppBound[i] = 2*(i + 1);
return;
}
if(!strcmp("WFG2", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 2);
for (i = 1; i < nvar; i++) uppBound[i] = 2*(i + 1);
return;
}
if(!strcmp("WFG3", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 2);
for (i = 1; i < nvar; i++) uppBound[i] = 2*(i + 1);
return;
}
if(!strcmp("WFG4", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 2);
for (i = 1; i < nvar; i++) uppBound[i] = 2*(i + 1);
return;
}
if(!strcmp("WFG5", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 2);
for (i = 1; i < nvar; i++) uppBound[i] = 2*(i + 1);
return;
}
if(!strcmp("WFG6", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 2);
for (i = 1; i < nvar; i++) uppBound[i] = 2*(i + 1);
return;
}
if(!strcmp("WFG7", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 2);
for (i = 1; i < nvar; i++) uppBound[i] = 2*(i + 1);
return;
}
if(!strcmp("WFG8", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 2);
for (i = 1; i < nvar; i++) uppBound[i] = 2*(i + 1);
return;
}
if(!strcmp("WFG9", strTestInstance))
{
lowBound = vector<double>(nvar, 0);
uppBound = vector<double>(nvar, 2);
for (i = 1; i < nvar; i++) uppBound[i] = 2*(i + 1);
return;
}
if(!strcmp("PStar", strTestInstance))
{
lowBound = vector<double>(nvar, 0.0);
uppBound = vector<double>(nvar, 100.0);
return;
}
if(!strcmp("LPMS", strTestInstance))
{
lowBound = vector<double>(nvar, -4.9);
uppBound = vector<double>(nvar, 3.2);
lowBound[1] = -3.5;
uppBound[1] = 6;
return;
}
if(!strcmp("DTLZ5_3", strTestInstance))
{
lowBound = vector<double>(nvar, 0.0);
uppBound = vector<double>(nvar, 1.0);
return;
}
if (!strcmp("ankang20001012", strTestInstance))
{
lowBound = vector<double>(nvar, 0.0);
uppBound = vector<double>(nvar, 37474.0);
return;
}
if (!strcmp("ankang20030828", strTestInstance))
{
lowBound = vector<double>(nvar, 0.0);
uppBound = vector<double>(nvar, 37474.0);
return;
}
if (!strcmp("ankang20051001", strTestInstance))
{
lowBound = vector<double>(nvar, 0.0);
uppBound = vector<double>(nvar, 37474.0);
return;
}
if (!strcmp("ankang20100715", strTestInstance))
{
lowBound = vector<double>(nvar, 0.0);
uppBound = vector<double>(nvar, 37474.0);
return;
}
}
#endif