-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHS69.SIF
486 lines (425 loc) · 15.4 KB
/
HS69.SIF
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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
***************************
* SET UP THE INITIAL DATA *
***************************
NAME HS69
* Problem :
* *********
* This is a cost optimal inspection plan.
* Source: problem 69 in
* W. Hock and K. Schittkowski,
* "Test examples for nonlinear programming codes",
* Lectures Notes in Economics and Mathematical Systems 187, Springer
* Verlag, Heidelberg, 1981.
* SIF input: Nick Gould, August 1991.
* classification OOR2-MN-4-2
* Number of variables
IE N 4
* problem parameters
RE A 0.1
RE B 1000.0
RE D 1.0
RE NN 4.0
* Other useful parameters
IE 1 1
R* AN A NN
R( ROOTN SQRT NN
R* DROOTN D ROOTN
RM -DROOTN DROOTN -1.0
VARIABLES
DO I 1 N
X X(I)
ND
GROUPS
N OBJ
E C1 X3 1.0D+0
E C2 X4 1.0D+0
BOUNDS
LO HS69 X1 0.0001
UP HS69 X1 100.0
UP HS69 X2 100.0
UP HS69 X3 2.0
UP HS69 X4 2.0
START POINT
HS69 'DEFAULT' 1.0
SOLUTION X1 2.93714D-02
SOLUTION X2 1.19026D+00
SOLUTION X3 2.33945D-01
SOLUTION X4 7.91669D-01
* Lagrange multipliers
SOLUTION C1 -3.28113D+01
SOLUTION C2 4.44734D+01
ELEMENT TYPE
* Objective function type 1
EV RECIP X1
* Objective function type 2
EV NASTYEXP X1 X3
EV NASTYEXP X4
EP NASTYEXP B
* Constraint function type 1
EV PHI X2
EP PHI P
ELEMENT USES
T OE1 RECIP
V OE1 X1 X1
T OE2 NASTYEXP
V OE2 X1 X1
V OE2 X3 X3
V OE2 X4 X4
ZP OE2 B B
T C1E1 PHI
V C1E1 X2 X2
XP C1E1 P 0.0D+0
T C2E1 PHI
V C2E1 X2 X2
ZP C2E1 P DROOTN
T C2E2 PHI
V C2E2 X2 X2
ZP C2E2 P -DROOTN
GROUP USES
ZE OBJ OE1 AN
XE OBJ OE2 -1.0D+0
E C1 C1E1 -2.0D+0
E C2 C2E1 -1.0D+0 C2E2 -1.0D+0
OBJECT BOUND
* Solution
*XL SOLUTION -9.56713D+02
ENDATA
***********************
* SET UP THE FUNCTION *
* AND RANGE ROUTINES *
***********************
ELEMENTS HS69
TEMPORARIES
R PHI
R E
R R
R S
R F1
R F2
R F3
R F4
R F11
R F12
R F13
R F14
R F15
R F16
R F17
R F18
R REC
M EXP
F PHI
GLOBALS
A REC 3.9894228040143270D-01
INDIVIDUALS
* Objective function type RECIP
T RECIP
F 1.0D+0 / X1
G X1 - 1.0D+0 / X1 ** 2
H X1 X1 2.0D+0 / X1 ** 3
* Objective function type NASTYEXP
T NASTYEXP
A E EXP( X1 )
A R B * ( E - 1.0D+0 ) - X3
A S E - 1.0D+0 + X4
A F1 - ( - ( R * X4 / S ) )
A+ / ( X1 * X1 )
A F2 - R / ( S * X1 )
A F3 - X4 / ( S * X1 )
A F4 ( X4 * R ) / ( X1 * S * S )
A F11 2.0D+0 * ( - ( R * X4 / S ) )
A+ / ( X1 * X1 * X1 )
A F12 E * X4 * ( ( R / S ) - B )
A+ / ( X1 * S )
A F11 F11 + F12
A F12 R / ( S * X1 * X1 )
A F13 X4 / ( S * X1 * X1 )
A F14 R / ( S * S * X1 )
A F15 - 1.0D+0 / ( S * X1 )
A F16 - X4 * R / ( S * S * X1 * X1 )
A F17 X4 / ( S * S * X1 )
A F18 - 2.0D+0 * X4 * R
A+ / ( X1 * S * S * S )
F X4 * R / ( S * X1 )
G X1 - F1 - ( B * E * F3 ) - ( E * F4 )
G X3 F3
G X4 - F2 - F4
H X1 X1 - F11 - ( 2.0D+0 * B * E * F13 ) -
H+ ( 2.0D+0 * E * F16 )
H+ - ( 2.0D+0 * B *
H+ E * E * F17 ) - ( E * E * F18 )
H X3 X1 F13 + ( E * F17 )
H X4 X1 - ( E * F14 ) - ( B * E * F15 ) - F16 -
H+ ( B * E * F17 ) - ( E * F18 ) - F12
H X4 X3 F15 + F17
H X4 X4 - ( 2.0D+0 * F14 ) - F18
* Constraint function type PHI
T PHI
A E EXP( - 5.0D-1 * ( - X2 + P ) ** 2 )
F PHI( - X2 + P )
G X2 - REC * E
H X2 X2 - REC * E * ( - X2 + P )
ENDATA
GROUPS HS69
ENDATA
DOUBLE PRECISION FUNCTION PHI( X )
INTEGER JINT
DOUBLE PRECISION ARG, X, RESULT
JINT = 0
ARG = 7.071067811865475D-1 * ABS( X )
CALL CALERF( ARG, RESULT, JINT )
IF ( X .GE. 0.0D+0 ) THEN
PHI = 5.0D-1 + 5.0D-1 * RESULT
ELSE
PHI = 5.0D-1 - 5.0D-1 * RESULT
END IF
RETURN
END
SUBROUTINE CALERF(ARG,RESULT,JINT)
C------------------------------------------------------------------
C
C This packet evaluates erf(x), erfc(x), and exp(x*x)*erfc(x)
C for a real argument x. It contains three FUNCTION type
C subprograms: ERF, ERFC, and ERFCX (or DERF, DERFC, and DERFCX),
C and one SUBROUTINE type subprogram, CALERF. The calling
C statements for the primary entries are:
C
C Y=ERF(X) (or Y=DERF(X)),
C
C Y=ERFC(X) (or Y=DERFC(X)),
C and
C Y=ERFCX(X) (or Y=DERFCX(X)).
C
C The routine CALERF is intended for internal packet use only,
C all computations within the packet being concentrated in this
C routine. The function subprograms invoke CALERF with the
C statement
C
C CALL CALERF(ARG,RESULT,JINT)
C
C where the parameter usage is as follows
C
C Function Parameters for CALERF
C call ARG Result JINT
C
C ERF(ARG) ANY REAL ARGUMENT ERF(ARG) 0
C ERFC(ARG) ABS(ARG) .LT. XBIG ERFC(ARG) 1
C ERFCX(ARG) XNEG .LT. ARG .LT. XMAX ERFCX(ARG) 2
C
C The main computation evaluates near-minimax approximations
C from "Rational Chebyshev approximations for the error function"
C by W. J. Cody, Math. Comp., 1969, PP. 631-638. This
C transportable program uses rational functions that theoretically
C approximate erf(x) and erfc(x) to at least 18 significant
C decimal digits. The accuracy achieved depends on the arithmetic
C system, the compiler, the intrinsic functions, and proper
C selection of the machine-dependent constants.
C
C*******************************************************************
C*******************************************************************
C
C Explanation of machine-dependent constants
C
C XMIN = the smallest positive floating-point number.
C XINF = the largest positive finite floating-point number.
C XNEG = the largest negative argument acceptable to ERFCX;
C the negative of the solution to the equation
C 2*exp(x*x) = XINF.
C XSMALL = argument below which erf(x) may be represented by
C 2*x/sqrt(pi) and above which x*x will not underflow.
C A conservative value is the largest machine number X
C such that 1.0 + X = 1.0 to machine precision.
C XBIG = largest argument acceptable to ERFC; solution to
C the equation: W(x) * (1-0.5/x**2) = XMIN, where
C W(x) = exp(-x*x)/[x*sqrt(pi)].
C XHUGE = argument above which 1.0 - 1/(2*x*x) = 1.0 to
C machine precision. A conservative value is
C 1/[2*sqrt(XSMALL)]
C XMAX = largest acceptable argument to ERFCX; the minimum
C of XINF and 1/[sqrt(pi)*XMIN].
C
C Approximate values for some important machines are:
C
C XMIN XINF XNEG XSMALL
C
C CDC 7600 (S.P.) 3.13E-294 1.26E+322 -27.220 7.11E-15
C CRAY-1 (S.P.) 4.58E-2467 5.45E+2465 -75.345 7.11E-15
C IEEE (IBM/XT,
C SUN, etc.) (S.P.) 1.18E-38 3.40E+38 -9.382 5.96E-8
C IEEE (IBM/XT,
C SUN, etc.) (D.P.) 2.23D-308 1.79D+308 -26.628 1.11D-16
C IBM 195 (D.P.) 5.40D-79 7.23E+75 -13.190 1.39D-17
C UNIVAC 1108 (D.P.) 2.78D-309 8.98D+307 -26.615 1.73D-18
C VAX D-Format (D.P.) 2.94D-39 1.70D+38 -9.345 1.39D-17
C VAX G-Format (D.P.) 5.56D-309 8.98D+307 -26.615 1.11D-16
C
C
C XBIG XHUGE XMAX
C
C CDC 7600 (S.P.) 25.922 8.39E+6 1.80X+293
C CRAY-1 (S.P.) 75.326 8.39E+6 5.45E+2465
C IEEE (IBM/XT,
C SUN, etc.) (S.P.) 9.194 2.90E+3 4.79E+37
C IEEE (IBM/XT,
C SUN, etc.) (D.P.) 26.543 6.71D+7 2.53D+307
C IBM 195 (D.P.) 13.306 1.90D+8 7.23E+75
C UNIVAC 1108 (D.P.) 26.582 5.37D+8 8.98D+307
C VAX D-Format (D.P.) 9.269 1.90D+8 1.70D+38
C VAX G-Format (D.P.) 26.569 6.71D+7 8.98D+307
C
C*******************************************************************
C*******************************************************************
C
C Error returns
C
C The program returns ERFC = 0 for ARG .GE. XBIG;
C
C ERFCX = XINF for ARG .LT. XNEG;
C and
C ERFCX = 0 for ARG .GE. XMAX.
C
C
C Intrinsic functions required are:
C
C ABS, AINT, EXP
C
C
C Author: W. J. Cody
C Mathematics and Computer Science Division
C Argonne National Laboratory
C Argonne, IL 60439
C
C Latest modification: March 19, 1990
C
C------------------------------------------------------------------
INTEGER I,JINT
DOUBLE PRECISION
1 A,ARG,B,C,D,DEL,FOUR,HALF,P,ONE,Q,RESULT,SIXTEN,SQRPI,
2 TWO,THRESH,X,XBIG,XDEN,XHUGE,XINF,XMAX,XNEG,XNUM,XSMALL,
3 Y,YSQ,ZERO
DIMENSION A(5),B(4),C(9),D(8),P(6),Q(5)
C------------------------------------------------------------------
C Mathematical constants
C------------------------------------------------------------------
DATA FOUR,ONE,HALF,TWO,ZERO/4.0D0,1.0D0,0.5D0,2.0D0,0.0D0/,
1 SQRPI/5.6418958354775628695D-1/,THRESH/0.46875D0/,
2 SIXTEN/16.0D0/
C------------------------------------------------------------------
C Machine-dependent constants
C------------------------------------------------------------------
DATA XINF,XNEG,XSMALL/1.79D308,-26.628D0,1.11D-16/,
1 XBIG,XHUGE,XMAX/26.543D0,6.71D7,2.53D307/
C------------------------------------------------------------------
C Coefficients for approximation to erf in first interval
C------------------------------------------------------------------
DATA A/3.16112374387056560D00,1.13864154151050156D02,
1 3.77485237685302021D02,3.20937758913846947D03,
2 1.85777706184603153D-1/
DATA B/2.36012909523441209D01,2.44024637934444173D02,
1 1.28261652607737228D03,2.84423683343917062D03/
C------------------------------------------------------------------
C Coefficients for approximation to erfc in second interval
C------------------------------------------------------------------
DATA C/5.64188496988670089D-1,8.88314979438837594D0,
1 6.61191906371416295D01,2.98635138197400131D02,
2 8.81952221241769090D02,1.71204761263407058D03,
3 2.05107837782607147D03,1.23033935479799725D03,
4 2.15311535474403846D-8/
DATA D/1.57449261107098347D01,1.17693950891312499D02,
1 5.37181101862009858D02,1.62138957456669019D03,
2 3.29079923573345963D03,4.36261909014324716D03,
3 3.43936767414372164D03,1.23033935480374942D03/
C------------------------------------------------------------------
C Coefficients for approximation to erfc in third interval
C------------------------------------------------------------------
DATA P/3.05326634961232344D-1,3.60344899949804439D-1,
1 1.25781726111229246D-1,1.60837851487422766D-2,
2 6.58749161529837803D-4,1.63153871373020978D-2/
DATA Q/2.56852019228982242D00,1.87295284992346047D00,
1 5.27905102951428412D-1,6.05183413124413191D-2,
2 2.33520497626869185D-3/
C------------------------------------------------------------------
X = ARG
Y = ABS(X)
IF (Y .LE. THRESH) THEN
C------------------------------------------------------------------
C Evaluate erf for |X| <= 0.46875
C------------------------------------------------------------------
YSQ = ZERO
IF (Y .GT. XSMALL) YSQ = Y * Y
XNUM = A(5)*YSQ
XDEN = YSQ
DO 20 I = 1, 3
XNUM = (XNUM + A(I)) * YSQ
XDEN = (XDEN + B(I)) * YSQ
20 CONTINUE
RESULT = X * (XNUM + A(4)) / (XDEN + B(4))
IF (JINT .NE. 0) RESULT = ONE - RESULT
IF (JINT .EQ. 2) RESULT = EXP(YSQ) * RESULT
GO TO 800
C------------------------------------------------------------------
C Evaluate erfc for 0.46875 <= |X| <= 4.0
C------------------------------------------------------------------
ELSE IF (Y .LE. FOUR) THEN
XNUM = C(9)*Y
XDEN = Y
DO 120 I = 1, 7
XNUM = (XNUM + C(I)) * Y
XDEN = (XDEN + D(I)) * Y
120 CONTINUE
RESULT = (XNUM + C(8)) / (XDEN + D(8))
IF (JINT .NE. 2) THEN
YSQ = AINT(Y*SIXTEN)/SIXTEN
DEL = (Y-YSQ)*(Y+YSQ)
RESULT = EXP(-YSQ*YSQ) * EXP(-DEL) * RESULT
END IF
C------------------------------------------------------------------
C Evaluate erfc for |X| > 4.0
C------------------------------------------------------------------
ELSE
RESULT = ZERO
IF (Y .GE. XBIG) THEN
IF ((JINT .NE. 2) .OR. (Y .GE. XMAX)) GO TO 300
IF (Y .GE. XHUGE) THEN
RESULT = SQRPI / Y
GO TO 300
END IF
END IF
YSQ = ONE / (Y * Y)
XNUM = P(6)*YSQ
XDEN = YSQ
DO 240 I = 1, 4
XNUM = (XNUM + P(I)) * YSQ
XDEN = (XDEN + Q(I)) * YSQ
240 CONTINUE
RESULT = YSQ *(XNUM + P(5)) / (XDEN + Q(5))
RESULT = (SQRPI - RESULT) / Y
IF (JINT .NE. 2) THEN
YSQ = AINT(Y*SIXTEN)/SIXTEN
DEL = (Y-YSQ)*(Y+YSQ)
RESULT = EXP(-YSQ*YSQ) * EXP(-DEL) * RESULT
END IF
END IF
C------------------------------------------------------------------
C Fix up for negative argument, erf, etc.
C------------------------------------------------------------------
300 IF (JINT .EQ. 0) THEN
RESULT = (HALF - RESULT) + HALF
IF (X .LT. ZERO) RESULT = -RESULT
ELSE IF (JINT .EQ. 1) THEN
IF (X .LT. ZERO) RESULT = TWO - RESULT
ELSE
IF (X .LT. ZERO) THEN
IF (X .LT. XNEG) THEN
RESULT = XINF
ELSE
YSQ = AINT(X*SIXTEN)/SIXTEN
DEL = (X-YSQ)*(X+YSQ)
Y = EXP(YSQ*YSQ) * EXP(DEL)
RESULT = (Y+Y) - RESULT
END IF
END IF
END IF
800 RETURN
C---------- Last card of CALERF ----------
END