-
Notifications
You must be signed in to change notification settings - Fork 1
/
asymp.jl
73 lines (72 loc) · 3.39 KB
/
asymp.jl
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
########################################################################################################
### GCMMA-MMA-Julia ###
### ###
### This file is part of GCMMA-MMA-Julia. GCMMA-MMA-Julia is licensed under the terms of GNU ###
### General Public License as published by the Free Software Foundation. For more information and ###
### the LICENSE file, see <https://github.com/pollinico/GCMMA-MMA-Julia/blob/main/LICENSE>. ###
### ###
### The orginal work is written by Krister Svanberg in MATLAB. ###
### This is the Julia version of the code written by Nicolò Pollini. ###
### version 18-05-2023 ###
########################################################################################################
#-------------------------------------------------------------
#
# Copyright (C) 2007 Krister Svanberg
#
# This file, asymp.m, is part of GCMMA-MMA-code.
#
# GCMMA-MMA-code is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of
# the License, or (at your option) any later version.
#
# This code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# (file COPYING) along with this file. If not, see
# <http://www.gnu.org/licenses/>.
#
# You should have received a file README along with this file,
# containing contact information. If not, see
# <http://www.smoptit.se/> or e-mail [email protected] or [email protected].
#
#------
#
# Values on the parameters raa0, raa, low and upp are
# calculated in the beginning of each outer iteration.
#
function asymp(outeriter,n,xval,xold1,xold2,xmin,xmax,low,upp,raa0,raa,raa0eps,raaeps,df0dx,dfdx);
#
eeen = ones(n)
xmami = xmax - xmin
xmamieps = 0.00001*eeen
xmami = max.(xmami,xmamieps)
raa0 = abs.(df0dx)'*xmami
raa0 = max.(raa0eps,(0.1/n)*raa0)
raa = abs.(dfdx)*xmami
raa = max.(raaeps,(0.1/n)*raa)
if outeriter < 2.5
low = xval - 0.5*xmami
upp = xval + 0.5*xmami
else
xxx = (xval-xold1).*(xold1-xold2)
factor = copy(eeen)
factor[findall(x -> x>0, xxx)] .= 1.2
factor[findall(x -> x<0, xxx)] .= 0.7
low = xval - factor.*(xold1 - low)
upp = xval + factor.*(upp - xold1)
lowmin = xval - 10*xmami
lowmax = xval - 0.01*xmami
uppmin = xval + 0.01*xmami
uppmax = xval + 10*xmami
low = max.(low,lowmin)
low = min.(low,lowmax)
upp = min.(upp,uppmax)
upp = max.(upp,uppmin)
end
return low,upp,raa0,raa
end
#---------------------------------------------------------------------