📄 asa-makefile
字号:
## The ASA generating probability distribution us used to generate new
## states. You can adaptively change this with your own function in
## asa_usr.c in user_generating_distrib() (and in
## recur_user_generating_distrib() if SELF_OPTIMIZE is TRUE) by setting
## USER_GENERATING_FUNCTION to TRUE.
#-DUSER_GENERATING_FUNCTION=FALSE
## If you wish to adaptively control the algorithm controlling
## reannealing of the cost function, this can be done in asa_usr.c in
## user_reanneal_cost() (and in recur_user_reanneal_cost() if
## SELF_OPTIMIZE is TRUE) by setting USER_REANNEAL_COST to TRUE.
#-DUSER_REANNEAL_COST=FALSE
## The macro used for reannealing parameter temperatures
## #define FUNCTION_REANNEAL_PARAMS(temperature, tangent, max_tangent) \
## (temperature * (max_tangent / tangent))
## is defined in asa.h. If you wish to adaptively control this function
## it can be defined in asa_usr.c in user_reanneal_params() (and in
## recur_user_reanneal_params() if SELF_OPTIMIZE is TRUE) by setting
## USER_REANNEAL_PARAMETERS to TRUE.
#-DUSER_REANNEAL_PARAMETERS=FALSE
## MAXIMUM_REANNEAL_INDEX is the maximum index (number of steps) at
## which the initial temperature and the index of the temperature are
## rescaled to avoid losing machine precision.
#-DMAXIMUM_REANNEAL_INDEX=50000
## REANNEAL_SCALE is the reannealing scale used when
## MAXIMUM_REANNEAL_INDEX is exceeded.
#-DREANNEAL_SCALE=10
## When ASA_SAMPLE is set to TRUE, data is collected by asa to
## importance-sample the users' variable space.
#-DASA_SAMPLE=FALSE
## When ASA_QUEUE is set to TRUE, a FIFO queue saves generated states,
## to avoid extra cost function calculations.
#-DASA_QUEUE=FALSE
## When ASA_RESOLUTION is set to TRUE, Coarse_Resolution[] defines the
## resolution of parameters in the fit.
#-DASA_RESOLUTION=FALSE
## When FITLOC is set to TRUE, three subroutines become available to
## shunt asa() over to a local simplex optimization.
#-DFITLOC=FALSE
## If FITLOC is set to TRUE and FITLOC_ROUND is TRUE, then each time
## parameters are passed to or between the local routines, they are first
## processed by rounding integers or respecting rounding according to
## ASA_RESOLUTION constraints.
#-DFITLOC_ROUND=TRUE
## When FITLOC is set to TRUE and FITLOC_PRINT is TRUE, the local
## fitting routines print out from the user module.
#-DFITLOC_PRINT=TRUE
## When MULTI_MIN is set to TRUE, the lowest Multi_Number values of the
## cost function and their parameters are saved.
#-DMULTI_MIN=FALSE
## When ASA_PARALLEL is set to TRUE, ASA is run in parallel-processor
## mode.
#-DASA_PARALLEL=FALSE
## When FDLIBM_POW is set to TRUE, a user-defined function s_pow() is
## used instead of pow(). This may be desirable on some machines when a
## speed-up can be realized.
#-DFDLIBM_POW=FALSE
## When FDLIBM_LOG is set to TRUE, a user-defined function s_log() is
## used instead of log(). This may be desirable on some machines when a
## speed-up can be realized.
#-DFDLIBM_LOG=FALSE
## When FDLIBM_EXP is set to TRUE, a user-defined function s_exp() is
## used instead of exp(). This may be desirable on some machines when a
## speed-up can be realized.
#-DFDLIBM_EXP=FALSE
###
### Printing Options
###
## Setting ASA_PRINT to FALSE will suppress all printing within asa.
#-DASA_PRINT=TRUE
## The name of the output file containing all printing from asa If you
## wish to attach a process number use ASA_OUT=\"asa_out_$$$$\" If
## ASA_OUT=\"STDOUT\" then ASA will print to stdout.
#-DASA_OUT=\"asa_out\"
## The name of the output file containing all printing from asa_usr.c If you
## wish to attach a process number use USER_OUT=\"asa_usr_out_$$$$\" If
## USER_OUT=\"STDOUT\" then asa_usr.c will print to stdout.
#-DUSER_OUT=\"asa_usr_out\"
## Some compilers on some systems under some levels of optimization will not
## compile if stdout is present in the code. All instances of stdout and
## printf in the user and the asa modules can be commented out by setting
## INCL_STDOUT to FALSE. Note that this also will suppress some output
## from such OPTIONS as ASA_PIPE, TIME_CALC, etc.
#-DINCL_STDOUT=TRUE
## If your wish to have the printing from asa be sent to a file
## determined dynamically from the user module, set USER_ASA_OUT to
## TRUE, and define the Program Option *Asa_Out_File in the user module.
## (This overrides any ASA_OUT settings.) In asa_usr.c, if
## USER_OPTIONS->Asa_Out_File = "STDOUT";, then ASA will print to stdout.
#-DUSER_ASA_OUT=FALSE
## Setting ASA_PRINT_INTERMED to FALSE will suppress intermediate
## printing within asa.
#-DASA_PRINT_INTERMED=TRUE
## Setting ASA_PRINT_MORE to TRUE will print out more intermediate
## information, e.g., new parameters whenever a new minimum is reported.
#-DASA_PRINT_MORE=FALSE
## The field width and precision for doubles is specified as
## G_FIELD.G_PRECISION.
#-DG_FIELD=12
#-DG_PRECISION=7
## When ASA_SAVE is set to TRUE, asa saves enough information after
## each newly best accepted state to restart from that point.
#-DASA_SAVE=FALSE
## If ASA_SAVE is set to TRUE, when ASA_SAVE_BACKUP is set to TRUE,
## asa saves enough information after each newly best accepted state to
## restart from any previous best accepted state when that
## asa_save.{best_state} is copied to asa_save.
#-DASA_SAVE_BACKUP=FALSE
## If ASA_SAVE_OPT is set to TRUE, when asa is restarted, if the file
## asa_opt_save is present in the same directory as asa_opt, then new values
## of ASA parameters and OPTIONS are read in after initializing to the
## point of the last writing of asa_save, without requiring recompilation.
#-DASA_SAVE_OPT=FALSE
## When ASA_PIPE is set to TRUE asa prints to STDOUT lines of
## data that can be used to update databases or charts.
#-DASA_PIPE=FALSE
## When ASA_PIPE_FILE is set to TRUE asa prints to asa_pipe lines of
## data that can be used to examine run data.
#DASA_PIPE_FILE=FALSE
## When SYSTEM_CALL is set to FALSE, asa avoids popen calls, e.g.,
## as in asa.c when ASA_SAVE is set to TRUE, to copy asa_save to
## asa_save.old. This is useful on machines that do not permit these
## commands.
#-DSYSTEM_CALL=TRUE
###
### Compiler Choices
###
## If HAVE_ANSI=TRUE use this block; otherwise, use the K&R block below.
## The gnu C compiler is the default.
#CC = g++
CC = gcc
CDEBUGFLAGS = -g -O -Wall # MY_TEMPLATE_flags
##
## If you use your system's ANSI compiler, e.g., named cc, use this block.
## Sun's ANSI compiler is named acc, so use CC = acc for this one.
#CC = acc
#CDEBUGFLAGS = -O
## If HAVE_ANSI=FALSE use this K&R block, or the next block with gcc
#CC = cc
#CDEBUGFLAGS = -O
#
#CC = gcc
#CDEBUGFLAGS = -traditional -g -O -Wall
## If you wish to include some profile statistics
#CC = gcc -pg
#CDEBUGFLAGS = -g -Wall
CFLAGS = $(CDEBUGFLAGS) $(DEFINE_OPTIONS)
## Under Cygwin, using ASA_LIB set TRUE and INCL_STDOUT set FALSE,
## use the following to produce a DLL with asa_dll: below
#CFLAGS = $(CDEBUGFLAGS) $(DEFINE_OPTIONS) -mno-cygwin -mrtd
LDFLAGS =
all:
make compile
make run
# make profile
###
### Document Formatting
###
doc:
## Use groff if you have it; add pep or colcrt to delete extra
## formatting. Under groff, using `more' or `less' presents an enhanced
## text. The following is used on Cygwin.
## Otherwise, standard UNIX macros are fine.
## The next 2 lines use standard UNIX utilities
# refer -e -P -n ASA-README.ms | tbl | nroff -ms > ASA-README+.txt
# refer -e -P -n ASA-README.ms | tbl | nroff -ms | pep > ASA-README.txt
##
## Similarly, you may format your own PostScript ASA-README.ps.
##
groff -wall -R -t -Tascii -ms ASA-README.ms > ASA-README+.txt
cat ASA-README+.txt | sed -e "s/\[1m//g" | sed -e "s/\[0m//g" | sed -e "s/\[4m//g" | sed -e "s/\[24m//g" > ASA-README.txt
groff -wall -R -t -e -ms ASA-README.ms > tp.ASA-README.ps
psselect -p1,56-,2-54 tp.ASA-README.ps > ASA-README.ps
rm tp.ASA-README.ps
ps2pdf ASA-README.ps
HTML/xread_html
chmod 644 ASA-README*
###
### Other Standard Arguments to Make
###
# MY_TEMPLATE_macros
#
## If COST_FILE is set to FALSE, asa_usr_cst.c may be deleted. If the
## name asa_usr_cst.c is changed, then this might be changed here as well.
USEROBJS = asa_usr.o asa_usr_cst.o # the name of the calling object files
ASAOBJS = asa.o # the ASA optimization object file
ASA_USER_INCL = asa.h asa_usr.h
# MY_TEMPLATE_OBJS =
# MY_TEMPLATE_incl =
# Use this 2-line compile instead of the next one if using MY_TEMPLATE_OBJS
#compile: $(USEROBJS) $(ASAOBJS) $(MY_TEMPLATE_OBJS)
# @$(CC) $(LDFLAGS) -o asa_run $(USEROBJS) $(ASAOBJS) $(MY_TEMPLATE_OBJS) -lm
compile: $(USEROBJS) $(ASAOBJS)
@$(CC) $(LDFLAGS) -o asa_run $(USEROBJS) $(ASAOBJS) -lm
## test for memory leaks
#compile: $(USEROBJS) $(ASAOBJS) $(MY_TEMPLATE_OBJS)
# @$(CC) $(LDFLAGS) -o asa_run $(USEROBJS) $(ASAOBJS) $(MY_TEMPLATE_OBJS) /usr/local/lib/leak.o -lm
$(USEROBJS): asa_usr.h # MY_TEMPLATE_user_incl
$(ASAOBJS): asa.h
$(ASA_USER_INCL): asa_usr_asa.h
# MY_TEMPLATE_depends
profile:
gprof -z asa_run > asa_profile
## CC and CFLAGS are passed into main, to be recorded in asa_usr_out.
## If "." is not in the path, use "./asa_run" instead of "asa_run" .
## Use a low value of nice for runs that are time- and CPU-intensive.
run:
asa_run $(CC) $(CFLAGS) # MY_TEMPLATE_run
# ./asa_run $(CC) $(CFLAGS) # MY_TEMPLATE_run
# nice -19 asa_run $(CC) $(CFLAGS)
# profile
clean:
rm -f *\.o asa_run* asadll* # MY_TEMPLATE_clean core gmon.out
realclean:
rm -f *\.o asa_run* asa_usr_out* asa_out* core asa_save* asa_rcur asa_sfop \
asa_[A-D]_[a-d] asa_pipe asadll* # MY_TEMPLATE_realclean gmon.out
docclean:
rm -f ASA-README.txt ASA-README.ps ASA-README.pdf
tgz:
mkdir ASA ; cp $(MANIFEST) ASA ; tar cBf - ASA | gzip --best > ASA.tar.gz ; rm -rf ASA
## Prepare DOS-zip using UNIX-zip
zip:
mkdir ASA ; cp $(MANIFEST) ASA ; /usr/bin/u2d ASA/*[^f] ; zip -rq9 ASA ASA ; rm -rf ASA
# under Cygwin change CFLAGS above to include -mno-cygwin -mrtd
dllmodule = asadll
obj_libs = $(MY_TEMPLATE_OBJS) $(USEROBJS) $(ASAOBJS)
dependency_libs = # -lm is a dummy /usr/lib/mingw/libm.a with Cygwin
#dependency_libs = -lm
# compiling without main(), using ASA_LIB, gives warning to be ignored.
asadll:
make -i compile
$(CC) $(CFLAGS) -shared -o ${dllmodule}.dll \
-Wl,--out-implib=${dllmodule}.lib \
-Wl,--compat-implib \
-Wl,--add-stdcall-alias \
-Wl,--enable-stdcall-fixup \
-Wl,--enable-auto-import \
-Wl,--enable-auto-image-base \
-Wl,--whole-archive ${obj_libs} \
-Wl,--export-all \
-Wl,--output-def=${dllmodule}.def \
-Wl,--no-whole-archive ${dependency_libs}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -