From 93c63fc531674d62a02fa9eb50c94c08ce37a68f Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Sun, 25 Jan 2009 19:11:56 +0000 Subject: [PATCH] move opti into linalg --- libsrc/Makefile.am | 2 +- libsrc/Makefile.in | 2 +- libsrc/include/opti.hpp | 2 +- libsrc/linalg/Makefile.am | 4 +- libsrc/opti/Makefile.am | 6 - libsrc/opti/Makefile.in | 491 -------------------------------------- libsrc/opti/bfgs.cpp | 410 ------------------------------- libsrc/opti/linopt.cpp | 73 ------ libsrc/opti/linsearch.cpp | 351 --------------------------- libsrc/opti/opti.hpp | 142 ----------- 10 files changed, 5 insertions(+), 1478 deletions(-) delete mode 100644 libsrc/opti/Makefile.am delete mode 100644 libsrc/opti/Makefile.in delete mode 100644 libsrc/opti/bfgs.cpp delete mode 100644 libsrc/opti/linopt.cpp delete mode 100644 libsrc/opti/linsearch.cpp delete mode 100644 libsrc/opti/opti.hpp diff --git a/libsrc/Makefile.am b/libsrc/Makefile.am index 1ab26b4c..8395087d 100644 --- a/libsrc/Makefile.am +++ b/libsrc/Makefile.am @@ -2,5 +2,5 @@ AM_CPPFLAGS = METASOURCES = AUTO -SUBDIRS = csg general geom2d gprim include interface linalg meshing occ opti \ +SUBDIRS = csg general geom2d gprim include interface linalg meshing occ \ parallel stlgeom visualization diff --git a/libsrc/Makefile.in b/libsrc/Makefile.in index 78d3ab21..acdb70df 100644 --- a/libsrc/Makefile.in +++ b/libsrc/Makefile.in @@ -216,7 +216,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = METASOURCES = AUTO -SUBDIRS = csg general geom2d gprim include interface linalg meshing occ opti \ +SUBDIRS = csg general geom2d gprim include interface linalg meshing occ \ parallel stlgeom visualization all: all-recursive diff --git a/libsrc/include/opti.hpp b/libsrc/include/opti.hpp index 6b8a0b61..5792d70f 100644 --- a/libsrc/include/opti.hpp +++ b/libsrc/include/opti.hpp @@ -1 +1 @@ -#include "../opti/opti.hpp" +#include "../linalg/opti.hpp" diff --git a/libsrc/linalg/Makefile.am b/libsrc/linalg/Makefile.am index 77022183..d39fa91b 100644 --- a/libsrc/linalg/Makefile.am +++ b/libsrc/linalg/Makefile.am @@ -1,7 +1,7 @@ -noinst_HEADERS = densemat.hpp linalg.hpp polynomial.hpp vector.hpp +noinst_HEADERS = densemat.hpp linalg.hpp polynomial.hpp vector.hpp opti.hpp AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include METASOURCES = AUTO noinst_LTLIBRARIES = libla.la -libla_la_SOURCES = densemat.cpp polynomial.cpp vector.cpp +libla_la_SOURCES = densemat.cpp polynomial.cpp vector.cpp bfgs.cpp linopt.cpp linsearch.cpp libla_la_LDFLAGS = -rdynamic diff --git a/libsrc/opti/Makefile.am b/libsrc/opti/Makefile.am deleted file mode 100644 index a80f6e37..00000000 --- a/libsrc/opti/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -noinst_HEADERS = opti.hpp - -AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include -METASOURCES = AUTO -noinst_LTLIBRARIES = libopti.la -libopti_la_SOURCES = bfgs.cpp linopt.cpp linsearch.cpp diff --git a/libsrc/opti/Makefile.in b/libsrc/opti/Makefile.in deleted file mode 100644 index e0c0e9d9..00000000 --- a/libsrc/opti/Makefile.in +++ /dev/null @@ -1,491 +0,0 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = libsrc/opti -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/tcl.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libopti_la_LIBADD = -am_libopti_la_OBJECTS = bfgs.lo linopt.lo linsearch.lo -libopti_la_OBJECTS = $(am_libopti_la_OBJECTS) -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(libopti_la_SOURCES) -DIST_SOURCES = $(libopti_la_SOURCES) -HEADERS = $(noinst_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH = @CYGPATH@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MPI_INCLUDES = @MPI_INCLUDES@ -MPI_LIBS = @MPI_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OCCFLAGS = @OCCFLAGS@ -OCCLIBS = @OCCLIBS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CFLAGS = @PKG_CFLAGS@ -PKG_HEADERS = @PKG_HEADERS@ -PKG_INCLUDES = @PKG_INCLUDES@ -PKG_LIBS = @PKG_LIBS@ -PKG_LIB_FILE = @PKG_LIB_FILE@ -PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@ -PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@ -PKG_STUB_SOURCES = @PKG_STUB_SOURCES@ -PKG_TCL_SOURCES = @PKG_TCL_SOURCES@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -TCL_BIN_DIR = @TCL_BIN_DIR@ -TCL_DEFS = @TCL_DEFS@ -TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@ -TCL_INCLUDES = @TCL_INCLUDES@ -TCL_LD_FLAGS = @TCL_LD_FLAGS@ -TCL_LIBS = @TCL_LIBS@ -TCL_LIB_FILE = @TCL_LIB_FILE@ -TCL_LIB_FLAG = @TCL_LIB_FLAG@ -TCL_LIB_SPEC = @TCL_LIB_SPEC@ -TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ -TCL_SRC_DIR = @TCL_SRC_DIR@ -TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ -TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ -TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ -TCL_VERSION = @TCL_VERSION@ -TK_BIN_DIR = @TK_BIN_DIR@ -TK_LIBS = @TK_LIBS@ -TK_LIB_FILE = @TK_LIB_FILE@ -TK_LIB_FLAG = @TK_LIB_FLAG@ -TK_LIB_SPEC = @TK_LIB_SPEC@ -TK_SRC_DIR = @TK_SRC_DIR@ -TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@ -TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@ -TK_STUB_LIB_SPEC = @TK_STUB_LIB_SPEC@ -TK_VERSION = @TK_VERSION@ -TK_XINCLUDES = @TK_XINCLUDES@ -TOGLLIBDIR = @TOGLLIBDIR@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_HEADERS = opti.hpp -AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include -METASOURCES = AUTO -noinst_LTLIBRARIES = libopti.la -libopti_la_SOURCES = bfgs.cpp linopt.cpp linsearch.cpp -all: all-am - -.SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libsrc/opti/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign libsrc/opti/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libopti.la: $(libopti_la_OBJECTS) $(libopti_la_DEPENDENCIES) - $(CXXLINK) $(libopti_la_OBJECTS) $(libopti_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bfgs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linopt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linsearch.Plo@am__quote@ - -.cpp.o: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cpp.lo: -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/libsrc/opti/bfgs.cpp b/libsrc/opti/bfgs.cpp deleted file mode 100644 index d106b6f1..00000000 --- a/libsrc/opti/bfgs.cpp +++ /dev/null @@ -1,410 +0,0 @@ -/***************************************************************************/ -/* */ -/* Vorlesung Optimierung I, Gfrerer, WS94/95 */ -/* BFGS-Verfahren zur Lösung freier nichtlinearer Optimierungsprobleme */ -/* */ -/* Programmautor: Joachim Schöberl */ -/* Matrikelnummer: 9155284 */ -/* */ -/***************************************************************************/ - -#include -#include - -#include -#include "opti.hpp" - - -namespace netgen -{ - -void Cholesky (const DenseMatrix & a, - DenseMatrix & l, Vector & d) -{ - // Factors A = L D L^T - - double x; - - int i, j, k; - int n = a.Height(); - - // (*testout) << "a = " << a << endl; - - l = a; - - for (i = 1; i <= n; i++) - { - for (j = i; j <= n; j++) - { - x = l.Get(i, j); - - for (k = 1; k < i; k++) - x -= l.Get(i, k) * l.Get(j, k) * d.Get(k); - - if (i == j) - { - d.Elem(i) = x; - } - else - { - l.Elem(j, i) = x / d.Get(k); - } - } - } - - for (i = 1; i <= n; i++) - { - l.Elem(i, i) = 1; - for (j = i+1; j <= n; j++) - l.Elem(i, j) = 0; - } - - /* - // Multiply: - (*testout) << "multiplied factors: " << endl; - for (i = 1; i <= n; i++) - for (j = 1; j <= n; j++) - { - x = 0; - for (k = 1; k <= n; k++) - x += l.Get(i, k) * l.Get(j, k) * d.Get(k); - (*testout) << x << " "; - } - (*testout) << endl; - */ -} - - -void MultLDLt (const DenseMatrix & l, const Vector & d, const Vector & g, Vector & p) -{ - /* - int i, j, n; - double val; - - n = l.Height(); - p = g; - for (i = 1; i <= n; i++) - { - val = 0; - for (j = i; j <= n; j++) - val += p.Get(j) * l.Get(j, i); - p.Set(i, val); - } - for (i = 1; i <= n; i++) - p.Elem(i) *= d.Get(i); - - for (i = n; i >= 1; i--) - { - val = 0; - for (j = 1; j <= i; j++) - val += p.Get(j) * l.Get(i, j); - p.Set(i, val); - } - */ - - - - double val; - - int n = l.Height(); - p = g; - - for (int i = 0; i < n; i++) - { - val = 0; - for (int j = i; j < n; j++) - val += p(j) * l(j, i); - p(i) = val; - } - - for (int i = 0; i < n; i++) - p(i) *= d(i); - - for (int i = n-1; i >= 0; i--) - { - val = 0; - for (int j = 0; j <= i; j++) - val += p(j) * l(i, j); - p(i) = val; - } -} - -void SolveLDLt (const DenseMatrix & l, const Vector & d, const Vector & g, Vector & p) -{ - double val; - - int n = l.Height(); - p = g; - - for (int i = 0; i < n; i++) - { - val = 0; - for (int j = 0; j < i; j++) - val += p(j) * l(i,j); - p(i) -= val; - } - - for (int i = 0; i < n; i++) - p(i) /= d(i); - - for (int i = n-1; i >= 0; i--) - { - val = 0; - for (int j = i+1; j < n; j++) - val += p(j) * l(j, i); - p(i) -= val; - } -} - -int LDLtUpdate (DenseMatrix & l, Vector & d, double a, const Vector & u) -{ - // Bemerkung: Es wird a aus R erlaubt - // Rueckgabewert: 0 .. D bleibt positiv definit - // 1 .. sonst - - int i, j, n; - - n = l.Height(); - - Vector v(n); - double t, told, xi; - - told = 1; - v = u; - - for (j = 1; j <= n; j++) - { - t = told + a * sqr (v.Elem(j)) / d.Get(j); - - if (t <= 0) - { - (*testout) << "update err, t = " << t << endl; - return 1; - } - - xi = a * v.Elem(j) / (d.Get(j) * t); - - d.Elem(j) *= t / told; - - for (i = j + 1; i <= n; i++) - { - v.Elem(i) -= v.Elem(j) * l.Elem(i, j); - l.Elem(i, j) += xi * v.Elem(i); - } - - told = t; - } - - return 0; -} - - -double BFGS ( - Vector & x, // i: Startwert - // o: Loesung, falls IFAIL = 0 - const MinFunction & fun, - const OptiParameters & par, - double eps - ) - - -{ - int i, j, n = x.Size(); - long it; - char a1crit, a3acrit; - - - Vector d(n), g(n), p(n), temp(n), bs(n), xneu(n), y(n), s(n), x0(n); - DenseMatrix l(n); - DenseMatrix hesse(n); - - double /* normg, */ alphahat, hd, fold; - double a1, a2; - const double mu1 = 0.1, sigma = 0.1, xi1 = 1, xi2 = 10; - const double tau = 0.1, tau1 = 0.1, tau2 = 0.6; - - Vector typx(x.Size()); // i: typische Groessenordnung der Komponenten - double f, f0; - double typf; // i: typische Groessenordnung der Loesung - double fmin = -1e5; // i: untere Schranke fuer Funktionswert - // double eps = 1e-8; // i: Abbruchschranke fuer relativen Gradienten - double tauf = 0.1; // i: Abbruchschranke fuer die relative Aenderung der - // Funktionswerte - int ifail; // o: 0 .. Erfolg - // -1 .. Unterschreitung von fmin - // 1 .. kein Erfolg bei Liniensuche - // 2 .. Überschreitung von itmax - - typx = par.typx; - typf = par.typf; - - - l = 0; - for (i = 1; i <= n; i++) - l.Elem(i, i) = 1; - - f = fun.FuncGrad (x, g); - f0 = f; - x0 = x; - - it = 0; - do - { - // Restart - - if (it % (5 * n) == 0) - { - - for (i = 1; i <= n; i++) - d.Elem(i) = typf/ sqr (typx.Get(i)); // 1; - for (i = 2; i <= n; i++) - for (j = 1; j < i; j++) - l.Elem(i, j) = 0; - - /* - hesse = 0; - for (i = 1; i <= n; i++) - hesse.Elem(i, i) = typf / sqr (typx.Get(i)); - - fun.ApproximateHesse (x, hesse); - - Cholesky (hesse, l, d); - */ - } - - it++; - if (it > par.maxit_bfgs) - { - ifail = 2; - break; - } - - - // Solve with factorized B - - SolveLDLt (l, d, g, p); - - // (*testout) << "l " << l << endl -// << "d " << d << endl -// << "g " << g << endl -// << "p " << p << endl; - - - p *= -1; - y = g; - - fold = f; - - // line search - - alphahat = 1; - lines (x, xneu, p, f, g, fun, par, alphahat, fmin, - mu1, sigma, xi1, xi2, tau, tau1, tau2, ifail); - - if(ifail == 1) - (*testout) << "no success with linesearch" << endl; - - /* - // if (it > par.maxit_bfgs/2) - { - (*testout) << "x = " << x << endl; - (*testout) << "xneu = " << xneu << endl; - (*testout) << "f = " << f << endl; - (*testout) << "g = " << g << endl; - } - */ - - // (*testout) << "it = " << it << " f = " << f << endl; - // if (ifail != 0) break; - - s.Set2 (1, xneu, -1, x); - y *= -1; - y.Add (1,g); // y += g; - - x = xneu; - - // BFGS Update - - MultLDLt (l, d, s, bs); - - a1 = y * s; - a2 = s * bs; - - if (a1 > 0 && a2 > 0) - { - if (LDLtUpdate (l, d, 1 / a1, y) != 0) - { - cerr << "BFGS update error1" << endl; - (*testout) << "BFGS update error1" << endl; - (*testout) << "l " << endl << l << endl - << "d " << d << endl; - ifail = 1; - break; - } - - if (LDLtUpdate (l, d, -1 / a2, bs) != 0) - { - cerr << "BFGS update error2" << endl; - (*testout) << "BFGS update error2" << endl; - (*testout) << "l " << endl << l << endl - << "d " << d << endl; - ifail = 1; - break; - } - } - - // Calculate stop conditions - - hd = eps * max2 (typf, fabs (f)); - a1crit = 1; - for (i = 1; i <= n; i++) - if ( fabs (g.Elem(i)) * max2 (typx.Elem(i), fabs (x.Elem(i))) > hd) - a1crit = 0; - - - a3acrit = (fold - f <= tauf * max2 (typf, fabs (f))); - - // testout << "g = " << g << endl; - // testout << "a1crit, a3crit = " << int(a1crit) << ", " << int(a3acrit) << endl; - - /* - // Output for tests - - normg = sqrt (g * g); - - testout << "it =" << setw (5) << it - << " f =" << setw (12) << setprecision (5) << f - << " |g| =" << setw (12) << setprecision (5) << normg; - - testout << " x = (" << setw (12) << setprecision (5) << x.Elem(1); - for (i = 2; i <= n; i++) - testout << "," << setw (12) << setprecision (5) << x.Elem(i); - testout << ")" << endl; - */ - - //(*testout) << "it = " << it << " f = " << f << " x = " << x << endl - // << " g = " << g << " p = " << p << endl << endl; - - // (*testout) << "|g| = " << g.L2Norm() << endl; - - if (g.L2Norm() < fun.GradStopping (x)) break; - - } - while (!a1crit || !a3acrit); - - /* - (*testout) << "it = " << it << " g = " << g << " f = " << f - << " fail = " << ifail << endl; - */ - if (f0 < f || (ifail == 1)) - { - (*testout) << "fail, f = " << f << " f0 = " << f0 << endl; - f = f0; - x = x0; - } - - // (*testout) << "x = " << x << ", x0 = " << x0 << endl; - return f; -} - -} diff --git a/libsrc/opti/linopt.cpp b/libsrc/opti/linopt.cpp deleted file mode 100644 index a5d381e6..00000000 --- a/libsrc/opti/linopt.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include - -#include -#include "opti.hpp" - -namespace netgen -{ - -void LinearOptimize (const DenseMatrix & a, const Vector & b, - const Vector & c, Vector & x) - - { - int i1, i2, i3, j; - DenseMatrix m(3), inv(3); - Vector rs(3), hx(3), res(a.Height()), res2(3); - double f, fmin; - int nrest; - - if (a.Width() != 3) - { - cerr << "LinearOptimize only implemented for 3 unknowns" << endl; - return; - } - - fmin = 1e10; - x = 0; - nrest = a.Height(); - for (i1 = 1; i1 <= nrest; i1++) - for (i2 = i1 + 1; i2 <= nrest; i2++) - for (i3 = i2 + 1; i3 <= nrest; i3++) - { - for (j = 1; j <= 3; j++) - { - m.Elem(1, j) = a.Get(i1, j); - m.Elem(2, j) = a.Get(i2, j); - m.Elem(3, j) = a.Get(i3, j); - } - - rs.Elem(1) = b.Get(i1); - rs.Elem(2) = b.Get(i2); - rs.Elem(3) = b.Get(i3); - - if (fabs (m.Det()) < 1e-12) continue; - - CalcInverse (m, inv); - inv.Mult (rs, hx); - - a.Residuum (hx, b, res); -// m.Residuum (hx, rs, res2); - f = c * hx; - -/* - testout -> precision(12); - (*testout) << "i = (" << i1 << "," << i2 << "," << i3 - << "), f = " << f << " x = " << x << " res = " << res - << " resmin = " << res.Min() - << " res2 = " << res2 << " prod = " << prod << endl; -*/ - - - double rmin = res.Elem(1); - for (int hi = 2; hi <= res.Size(); hi++) - if (res.Elem(hi) < rmin) rmin = res.Elem(hi); - - if ( (f < fmin) && rmin >= -1e-8) - { - fmin = f; - x = hx; - } - } - } -} diff --git a/libsrc/opti/linsearch.cpp b/libsrc/opti/linsearch.cpp deleted file mode 100644 index 4c297fd9..00000000 --- a/libsrc/opti/linsearch.cpp +++ /dev/null @@ -1,351 +0,0 @@ -/***************************************************************************/ -/* */ -/* Problem: Liniensuche */ -/* */ -/* Programmautor: Joachim Schöberl */ -/* Matrikelnummer: 9155284 */ -/* */ -/* Algorithmus nach: */ -/* */ -/* Optimierung I, Gfrerer, WS94/95 */ -/* Algorithmus 2.1: Liniensuche Problem (ii) */ -/* */ -/***************************************************************************/ - - - -#include - -#include // min, max, sqr - -#include -#include "opti.hpp" - - -namespace netgen -{ -const double eps0 = 1E-15; - -// Liniensuche - - -double MinFunction :: Func (const Vector & /* x */) const -{ - cerr << "Func of MinFunction called" << endl; - return 0; -} - -void MinFunction :: Grad (const Vector & /* x */, Vector & /* g */) const -{ - cerr << "Grad of MinFunction called" << endl; -} - -double MinFunction :: FuncGrad (const Vector & x, Vector & g) const -{ - cerr << "Grad of MinFunction called" << endl; - return 0; - /* - int n = x.Size(); - - static Vector xr; - static Vector xl; - xr.SetSize(n); - xl.SetSize(n); - - double eps = 1e-6; - double fl, fr; - - for (int i = 1; i <= n; i++) - { - xr.Set (1, x); - xl.Set (1, x); - - xr.Elem(i) += eps; - fr = Func (xr); - - xl.Elem(i) -= eps; - fl = Func (xl); - - g.Elem(i) = (fr - fl) / (2 * eps); - } - - double f = Func(x); - // (*testout) << "f = " << f << " grad = " << g << endl; - return f; - */ -} - - -double MinFunction :: FuncDeriv (const Vector & x, const Vector & dir, double & deriv) const -{ - Vector g(x.Size()); - double f = FuncGrad (x, g); - deriv = (g * dir); - - // (*testout) << "g = " << g << ", dir = " << dir << ", deriv = " << deriv << endl; - return f; -} - -void MinFunction :: ApproximateHesse (const Vector & x, - DenseMatrix & hesse) const -{ - int n = x.Size(); - int i, j; - - static Vector hx; - hx.SetSize(n); - - double eps = 1e-6; - double f, f11, f12, f21, f22; - - for (i = 1; i <= n; i++) - { - for (j = 1; j < i; j++) - { - hx = x; - hx.Elem(i) = x.Get(i) + eps; - hx.Elem(j) = x.Get(j) + eps; - f11 = Func(hx); - hx.Elem(i) = x.Get(i) + eps; - hx.Elem(j) = x.Get(j) - eps; - f12 = Func(hx); - hx.Elem(i) = x.Get(i) - eps; - hx.Elem(j) = x.Get(j) + eps; - f21 = Func(hx); - hx.Elem(i) = x.Get(i) - eps; - hx.Elem(j) = x.Get(j) - eps; - f22 = Func(hx); - - hesse.Elem(i, j) = hesse.Elem(j, i) = - (f11 + f22 - f12 - f21) / (2 * eps * eps); - } - - hx = x; - f = Func(x); - hx.Elem(i) = x.Get(i) + eps; - f11 = Func(hx); - hx.Elem(i) = x.Get(i) - eps; - f22 = Func(hx); - - hesse.Elem(i, i) = (f11 + f22 - 2 * f) / (eps * eps); - } - // (*testout) << "hesse = " << hesse << endl; -} - - - - - - - -/// Line search, modified Mangasarien conditions -void lines (Vector & x, // i: initial point of line-search - Vector & xneu, // o: solution, if successful - Vector & p, // i: search direction - double & f, // i: function-value at x - // o: function-value at xneu, iff ifail = 0 - Vector & g, // i: gradient at x - // o: gradient at xneu, iff ifail = 0 - const MinFunction & fun, // function to minimize - const OptiParameters & par, - double & alphahat, // i: initial value for alpha_hat - // o: solution alpha iff ifail = 0 - double fmin, // i: lower bound for f - double mu1, // i: Parameter mu_1 of Alg.2.1 - double sigma, // i: Parameter sigma of Alg.2.1 - double xi1, // i: Parameter xi_1 of Alg.2.1 - double xi2, // i: Parameter xi_1 of Alg.2.1 - double tau, // i: Parameter tau of Alg.2.1 - double tau1, // i: Parameter tau_1 of Alg.2.1 - double tau2, // i: Parameter tau_2 of Alg.2.1 - int & ifail) // o: 0 on success - // -1 bei termination because lower limit fmin - // 1 bei illegal termination due to different reasons - -{ - double phi0, phi0prime, phi1, phi1prime, phihatprime; - double alpha1, alpha2, alphaincr, c; - char flag = 1; - long it; - - alpha1 = 0; - alpha2 = 1e50; - phi0 = phi1 = f; - - phi0prime = g * p; - - if (phi0prime > 0) - { - ifail = 1; - return; - } - - ifail = 1; // Markus - - phi1prime = phi0prime; - - // (*testout) << "phi0prime = " << phi0prime << endl; - - // it = 100000l; - it = 0; - - while (it++ <= par.maxit_linsearch) - { - - xneu.Set2 (1, x, alphahat, p); - - - // f = fun.FuncGrad (xneu, g); - // f = fun.Func (xneu); - f = fun.FuncDeriv (xneu, p, phihatprime); - - // (*testout) << "lines, f = " << f << " phip = " << phihatprime << endl; - - if (f < fmin) - { - ifail = -1; - break; - } - - - if (alpha2 - alpha1 < eps0 * alpha2) - { - ifail = 0; - break; - } - - // (*testout) << "i = " << it << " al = " << alphahat << " f = " << f << " fprime " << phihatprime << endl;; - - if (f - phi0 > mu1 * alphahat * phi1prime + eps0 * fabs (phi0)) - - { - - flag = 0; - alpha2 = alphahat; - - c = - (f - phi1 - phi1prime * (alphahat-alpha1)) / - sqr (alphahat-alpha1); - - alphahat = alpha1 - 0.5 * phi1prime / c; - - if (alphahat > alpha2) - alphahat = alpha1 + 1/(4*c) * - ( (sigma+mu1) * phi0prime - 2*phi1prime - + sqrt (sqr(phi1prime - mu1 * phi0prime) - - 4 * (phi1 - phi0 - mu1 * alpha1 * phi0prime) * c)); - - alphahat = max2 (alphahat, alpha1 + tau * (alpha2 - alpha1)); - alphahat = min2 (alphahat, alpha2 - tau * (alpha2 - alpha1)); - - // (*testout) << " if-branch" << endl; - - } - - else - - { - /* - f = fun.FuncGrad (xneu, g); - phihatprime = g * p; - */ - f = fun.FuncDeriv (xneu, p, phihatprime); - - if (phihatprime < sigma * phi0prime * (1 + eps0)) - - { - if (phi1prime < phihatprime) - // Approximationsfunktion ist konvex - - alphaincr = (alphahat - alpha1) * phihatprime / - (phi1prime - phihatprime); - - else - alphaincr = 1e99; // MAXDOUBLE; - - if (flag) - { - alphaincr = max2 (alphaincr, xi1 * (alphahat-alpha1)); - alphaincr = min2 (alphaincr, xi2 * (alphahat-alpha1)); - } - else - { - alphaincr = max2 (alphaincr, tau1 * (alpha2 - alphahat)); - alphaincr = min2 (alphaincr, tau2 * (alpha2 - alphahat)); - } - - alpha1 = alphahat; - alphahat += alphaincr; - phi1 = f; - phi1prime = phihatprime; - } - - else - - { - ifail = 0; // Erfolg !! - break; - } - - // (*testout) << " else, " << endl; - - } - - } - - // (*testout) << "linsearch: it = " << it << " ifail = " << ifail << endl; - - fun.FuncGrad (xneu, g); - - - if (it < 0) - ifail = 1; - - // (*testout) << "fail = " << ifail << endl; -} - - - - - - - - - - - - - - - - - - - -void SteepestDescent (Vector & x, const MinFunction & fun, - const OptiParameters & par) -{ - int it, n = x.Size(); - Vector xnew(n), p(n), g(n), g2(n); - double val, alphahat; - int fail; - - val = fun.FuncGrad(x, g); - - alphahat = 1; - // testout << "f = "; - for (it = 0; it < 10; it++) - { - // testout << val << " "; - - // p = -g; - p.Set (-1, g); - - lines (x, xnew, p, val, g, fun, par, alphahat, -1e5, - 0.1, 0.1, 1, 10, 0.1, 0.1, 0.6, fail); - - x = xnew; - } - // testout << endl; -} -} diff --git a/libsrc/opti/opti.hpp b/libsrc/opti/opti.hpp deleted file mode 100644 index 98757869..00000000 --- a/libsrc/opti/opti.hpp +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef FILE_OPTI -#define FILE_OPTI - -/**************************************************************************/ -/* File: opti.hpp */ -/* Author: Joachim Schoeberl */ -/* Date: 01. Jun. 95 */ -/**************************************************************************/ - - - -namespace netgen -{ - - /** - Function to be minimized. - */ - class MinFunction - { - public: - /// - virtual double Func (const Vector & x) const; - /// - virtual void Grad (const Vector & x, Vector & g) const; - /// function and gradient - virtual double FuncGrad (const Vector & x, Vector & g) const; - /// directional derivative - virtual double FuncDeriv (const Vector & x, const Vector & dir, double & deriv) const; - /// if |g| < gradaccuray, then stop bfgs - virtual double GradStopping (const Vector & /* x */) const { return 0; } - - /// - virtual void ApproximateHesse (const Vector & /* x */, - DenseMatrix & /* hesse */) const; - }; - - - class OptiParameters - { - public: - int maxit_linsearch; - int maxit_bfgs; - double typf; - double typx; - - OptiParameters () - { - maxit_linsearch = 100; - maxit_bfgs = 100; - typf = 1; - typx = 1; - } - }; - - - /** Implementation of BFGS method. - Efficient method for non-linear minimiztion problems. - @param x initial value and solution - @param fun function to be minimized - */ - extern double BFGS (Vector & x, const MinFunction & fun, - const OptiParameters & par, - double eps = 1e-8); - - /** Steepest descent method. - Simple method for non-linear minimization problems. - @param x initial value and solution - @param fun function to be minimized - */ - void SteepestDescent (Vector & x, const MinFunction & fun, - const OptiParameters & par); - - - extern void lines ( - Vector & x, // i: Ausgangspunkt der Liniensuche - Vector & xneu, // o: Loesung der Liniensuche bei Erfolg - Vector & p, // i: Suchrichtung - double & f, // i: Funktionswert an der Stelle x - // o: Funktionswert an der Stelle xneu, falls ifail = 0 - Vector & g, // i: Gradient an der Stelle x - // o: Gradient an der Stelle xneu, falls ifail = 0 - - const MinFunction & fun, // function to minmize - const OptiParameters & par, // parameters - double & alphahat, // i: Startwert für alpha_hat - // o: Loesung falls ifail = 0 - double fmin, // i: untere Schranke für f - double mu1, // i: Parameter mu_1 aus Alg.2.1 - double sigma, // i: Parameter sigma aus Alg.2.1 - double xi1, // i: Parameter xi_1 aus Alg.2.1 - double xi2, // i: Parameter xi_1 aus Alg.2.1 - double tau, // i: Parameter tau aus Alg.2.1 - double tau1, // i: Parameter tau_1 aus Alg.2.1 - double tau2, // i: Parameter tau_2 aus Alg.2.1 - int & ifail); // o: 0 bei erfolgreicher Liniensuche - // -1 bei Abbruch wegen Unterschreiten von fmin - // 1 bei Abbruch, aus sonstigen Gründen - - - - - /** - Solver for linear programming problem. - - \begin{verbatim} - min c^t x - A x <= b - \end{verbatim} - */ - extern void LinearOptimize (const DenseMatrix & a, const Vector & b, - const Vector & c, Vector & x); - - -#ifdef NONE - - /** - Simple projection iteration. - - find $u = argmin_{v >= 0} 0.5 u A u - f u$ - */ - extern void ApproxProject (const BaseMatrix & a, Vector & u, - const Vector & f, - double tau, int its); - - - /** - CG Algorithm for quadratic programming problem. - See: Dostal ... - - d ... diag(A) ^{-1} - */ - extern void ApproxProjectCG (const BaseMatrix & a, Vector & x, - const Vector & b, const class DiagMatrix & d, - double gamma, int & steps, int & changes); - -#endif - - -} - -#endif -