Diff of the two buildlogs: -- --- b1/build.log 2024-05-07 15:46:54.134562525 +0000 +++ b2/build.log 2024-05-07 16:04:18.706116183 +0000 @@ -1,6 +1,6 @@ I: pbuilder: network access will be disabled during build -I: Current time: Mon Jun 9 10:04:29 -12 2025 -I: pbuilder-time-stamp: 1749506669 +I: Current time: Wed May 8 05:46:57 +14 2024 +I: pbuilder-time-stamp: 1715096817 I: Building the build Environment I: extracting base tarball [/var/cache/pbuilder/trixie-reproducible-base.tgz] I: copying local configuration @@ -31,52 +31,84 @@ dpkg-source: info: applying remove-Makefile-in-distclean-rule.patch I: Not using root during the build. I: Installing the build-deps -I: user script /srv/workspace/pbuilder/3250465/tmp/hooks/D02_print_environment starting +I: user script /srv/workspace/pbuilder/933139/tmp/hooks/D01_modify_environment starting +debug: Running on ionos11-amd64. +I: Changing host+domainname to test build reproducibility +I: Adding a custom variable just for the fun of it... +I: Changing /bin/sh to bash +'/bin/sh' -> '/bin/bash' +lrwxrwxrwx 1 root root 9 May 7 15:47 /bin/sh -> /bin/bash +I: Setting pbuilder2's login shell to /bin/bash +I: Setting pbuilder2's GECOS to second user,second room,second work-phone,second home-phone,second other +I: user script /srv/workspace/pbuilder/933139/tmp/hooks/D01_modify_environment finished +I: user script /srv/workspace/pbuilder/933139/tmp/hooks/D02_print_environment starting I: set - BUILDDIR='/build/reproducible-path' - BUILDUSERGECOS='first user,first room,first work-phone,first home-phone,first other' - BUILDUSERNAME='pbuilder1' - BUILD_ARCH='amd64' - DEBIAN_FRONTEND='noninteractive' - DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=42 ' - DISTRIBUTION='trixie' - HOME='/root' - HOST_ARCH='amd64' + BASH=/bin/sh + BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath + BASH_ALIASES=() + BASH_ARGC=() + BASH_ARGV=() + BASH_CMDS=() + BASH_LINENO=([0]="12" [1]="0") + BASH_LOADABLES_PATH=/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:. + BASH_SOURCE=([0]="/tmp/hooks/D02_print_environment" [1]="/tmp/hooks/D02_print_environment") + BASH_VERSINFO=([0]="5" [1]="2" [2]="21" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu") + BASH_VERSION='5.2.21(1)-release' + BUILDDIR=/build/reproducible-path + BUILDUSERGECOS='second user,second room,second work-phone,second home-phone,second other' + BUILDUSERNAME=pbuilder2 + BUILD_ARCH=amd64 + DEBIAN_FRONTEND=noninteractive + DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=20 ' + DIRSTACK=() + DISTRIBUTION=trixie + EUID=0 + FUNCNAME=([0]="Echo" [1]="main") + GROUPS=() + HOME=/root + HOSTNAME=i-capture-the-hostname + HOSTTYPE=x86_64 + HOST_ARCH=amd64 IFS=' ' - INVOCATION_ID='95fea1ae9968491b83c0b2c98c2c2461' - LANG='C' - LANGUAGE='en_US:en' - LC_ALL='C' - MAIL='/var/mail/root' - OPTIND='1' - PATH='/usr/sbin:/usr/bin:/sbin:/bin:/usr/games' - PBCURRENTCOMMANDLINEOPERATION='build' - PBUILDER_OPERATION='build' - PBUILDER_PKGDATADIR='/usr/share/pbuilder' - PBUILDER_PKGLIBDIR='/usr/lib/pbuilder' - PBUILDER_SYSCONFDIR='/etc' - PPID='3250465' - PS1='# ' - PS2='> ' + INVOCATION_ID=fdb45447991e4a849a255447997f8125 + LANG=C + LANGUAGE=et_EE:et + LC_ALL=C + MACHTYPE=x86_64-pc-linux-gnu + MAIL=/var/mail/root + OPTERR=1 + OPTIND=1 + OSTYPE=linux-gnu + PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path + PBCURRENTCOMMANDLINEOPERATION=build + PBUILDER_OPERATION=build + PBUILDER_PKGDATADIR=/usr/share/pbuilder + PBUILDER_PKGLIBDIR=/usr/lib/pbuilder + PBUILDER_SYSCONFDIR=/etc + PIPESTATUS=([0]="0") + POSIXLY_CORRECT=y + PPID=933139 PS4='+ ' - PWD='/' - SHELL='/bin/bash' - SHLVL='2' - SUDO_COMMAND='/usr/bin/timeout -k 18.1h 18h /usr/bin/ionice -c 3 /usr/bin/nice /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.QcslayNN/pbuilderrc_4HrE --distribution trixie --hookdir /etc/pbuilder/first-build-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/trixie-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.QcslayNN/b1 --logfile b1/build.log octave-optim_1.6.2-3.dsc' - SUDO_GID='111' - SUDO_UID='106' - SUDO_USER='jenkins' - TERM='unknown' - TZ='/usr/share/zoneinfo/Etc/GMT+12' - USER='root' - _='/usr/bin/systemd-run' - http_proxy='http://213.165.73.152:3128' + PWD=/ + SHELL=/bin/bash + SHELLOPTS=braceexpand:errexit:hashall:interactive-comments:posix + SHLVL=3 + SUDO_COMMAND='/usr/bin/timeout -k 24.1h 24h /usr/bin/ionice -c 3 /usr/bin/nice -n 11 /usr/bin/unshare --uts -- /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.QcslayNN/pbuilderrc_trGC --distribution trixie --hookdir /etc/pbuilder/rebuild-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/trixie-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.QcslayNN/b2 --logfile b2/build.log octave-optim_1.6.2-3.dsc' + SUDO_GID=111 + SUDO_UID=106 + SUDO_USER=jenkins + TERM=unknown + TZ=/usr/share/zoneinfo/Etc/GMT-14 + UID=0 + USER=root + _='I: set' + http_proxy=http://46.16.76.132:3128 I: uname -a - Linux ionos15-amd64 6.6.13+bpo-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.6.13-1~bpo12+1 (2024-02-15) x86_64 GNU/Linux + Linux i-capture-the-hostname 6.1.0-21-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) x86_64 GNU/Linux I: ls -l /bin - lrwxrwxrwx 1 root root 7 Jun 8 17:46 /bin -> usr/bin -I: user script /srv/workspace/pbuilder/3250465/tmp/hooks/D02_print_environment finished + lrwxrwxrwx 1 root root 7 May 7 11:25 /bin -> usr/bin +I: user script /srv/workspace/pbuilder/933139/tmp/hooks/D02_print_environment finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy @@ -702,7 +734,7 @@ Get: 576 http://deb.debian.org/debian trixie/main amd64 texlive-latex-base all 2023.20240207-1 [1255 kB] Get: 577 http://deb.debian.org/debian trixie/main amd64 texlive-latex-recommended all 2023.20240207-1 [8843 kB] Get: 578 http://deb.debian.org/debian trixie/main amd64 texlive all 2023.20240207-1 [18.2 kB] -Fetched 318 MB in 6s (55.3 MB/s) +Fetched 318 MB in 27s (11.8 MB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package poppler-data. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 19698 files and directories currently installed.) @@ -3086,7 +3118,11 @@ Building tag database... -> Finished parsing the build-deps I: Building the package -I: Running cd /build/reproducible-path/octave-optim-1.6.2/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-genchanges -S > ../octave-optim_1.6.2-3_source.changes +I: user script /srv/workspace/pbuilder/933139/tmp/hooks/A99_set_merged_usr starting +Not re-configuring usrmerge for trixie +I: user script /srv/workspace/pbuilder/933139/tmp/hooks/A99_set_merged_usr finished +hostname: Name or service not known +I: Running cd /build/reproducible-path/octave-optim-1.6.2/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-genchanges -S > ../octave-optim_1.6.2-3_source.changes dpkg-buildpackage: info: source package octave-optim dpkg-buildpackage: info: source version 1.6.2-3 dpkg-buildpackage: info: source distribution unstable @@ -3226,55 +3262,55 @@ then echo "The string 'DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS' must not be present in source code, but is in __disna_optim__.cc."; \ exit 1; \ fi +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection error-helpers.cc -o error-helpers.o if grep -q DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS __max_nargin_optim__.cc; \ then echo "The string 'DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS' must not be present in source code, but is in __max_nargin_optim__.cc."; \ exit 1; \ fi -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection error-helpers.cc -o error-helpers.o (echo "#include "; \ echo "int main () {"; \ sed -e s/DEFUN_DLD/DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/g \ - -e s/DEFUNX_DLD/DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/g __bfgsmin.cc \ + -e s/DEFUNX_DLD/DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/g numgradient.cc \ | g++ -E `/usr/bin/mkoctfile --verbose -p INCFLAGS` -x c++ -iquote '.' \ -D'DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,args,nargout,doc)=DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)' \ -D'DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,fname,gname,args,nargout,doc)=DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)' - \ | sed -e '/.*DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/!D'; \ echo "}"; \ ) \ - | g++ -x c++ -D'DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)=printf("%c" #name "\n@c " #name " __bfgsmin.cc\n" doc "\n\n", 0x1D);' -o __bfgsmin.bin - + | g++ -x c++ -D'DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)=printf("%c" #name "\n@c " #name " numgradient.cc\n" doc "\n\n", 0x1D);' -o numgradient.bin - (echo "#include "; \ echo "int main () {"; \ sed -e s/DEFUN_DLD/DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/g \ - -e s/DEFUNX_DLD/DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/g numgradient.cc \ + -e s/DEFUNX_DLD/DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/g numhessian.cc \ | g++ -E `/usr/bin/mkoctfile --verbose -p INCFLAGS` -x c++ -iquote '.' \ -D'DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,args,nargout,doc)=DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)' \ -D'DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,fname,gname,args,nargout,doc)=DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)' - \ | sed -e '/.*DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/!D'; \ echo "}"; \ ) \ - | g++ -x c++ -D'DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)=printf("%c" #name "\n@c " #name " numgradient.cc\n" doc "\n\n", 0x1D);' -o numgradient.bin - + | g++ -x c++ -D'DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)=printf("%c" #name "\n@c " #name " numhessian.cc\n" doc "\n\n", 0x1D);' -o numhessian.bin - (echo "#include "; \ echo "int main () {"; \ sed -e s/DEFUN_DLD/DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/g \ - -e s/DEFUNX_DLD/DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/g numhessian.cc \ + -e s/DEFUNX_DLD/DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/g __disna_optim__.cc \ | g++ -E `/usr/bin/mkoctfile --verbose -p INCFLAGS` -x c++ -iquote '.' \ -D'DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,args,nargout,doc)=DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)' \ -D'DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,fname,gname,args,nargout,doc)=DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)' - \ | sed -e '/.*DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/!D'; \ echo "}"; \ ) \ - | g++ -x c++ -D'DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)=printf("%c" #name "\n@c " #name " numhessian.cc\n" doc "\n\n", 0x1D);' -o numhessian.bin - + | g++ -x c++ -D'DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)=printf("%c" #name "\n@c " #name " __disna_optim__.cc\n" doc "\n\n", 0x1D);' -o __disna_optim__.bin - (echo "#include "; \ echo "int main () {"; \ sed -e s/DEFUN_DLD/DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/g \ - -e s/DEFUNX_DLD/DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/g __disna_optim__.cc \ + -e s/DEFUNX_DLD/DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/g __bfgsmin.cc \ | g++ -E `/usr/bin/mkoctfile --verbose -p INCFLAGS` -x c++ -iquote '.' \ -D'DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,args,nargout,doc)=DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)' \ -D'DEFUNX_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,fname,gname,args,nargout,doc)=DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)' - \ | sed -e '/.*DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/!D'; \ echo "}"; \ ) \ - | g++ -x c++ -D'DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)=printf("%c" #name "\n@c " #name " __disna_optim__.cc\n" doc "\n\n", 0x1D);' -o __disna_optim__.bin - + | g++ -x c++ -D'DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)=printf("%c" #name "\n@c " #name " __bfgsmin.cc\n" doc "\n\n", 0x1D);' -o __bfgsmin.bin - (echo "#include "; \ echo "int main () {"; \ sed -e s/DEFUN_DLD/DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS/g \ @@ -3288,46 +3324,46 @@ | g++ -x c++ -D'DEFUN_DLD_REPLACEMENT_FOR_PACKAGE_DOCS(name,doc)=printf("%c" #name "\n@c " #name " __max_nargin_optim__.cc\n" doc "\n\n", 0x1D);' -o __max_nargin_optim__.bin - (echo "### This file is generated automatically from the"; \ echo "### corresponding .cc file by a Makefile rule."; \ - echo ""; ./__max_nargin_optim__.bin) > __max_nargin_optim__.cc.docstrings + echo ""; ./numgradient.bin) > numgradient.cc.docstrings (echo "### This file is generated automatically from the"; \ echo "### corresponding .cc file by a Makefile rule."; \ - echo ""; ./__disna_optim__.bin) > __disna_optim__.cc.docstrings + echo ""; ./__bfgsmin.bin) > __bfgsmin.cc.docstrings (echo "### This file is generated automatically from the"; \ echo "### corresponding .cc file by a Makefile rule."; \ echo ""; ./numhessian.bin) > numhessian.cc.docstrings (echo "### This file is generated automatically from the"; \ echo "### corresponding .cc file by a Makefile rule."; \ - echo ""; ./__bfgsmin.bin) > __bfgsmin.cc.docstrings + echo ""; ./__max_nargin_optim__.bin) > __max_nargin_optim__.cc.docstrings (echo "### This file is generated automatically from the"; \ echo "### corresponding .cc file by a Makefile rule."; \ - echo ""; ./numgradient.bin) > numgradient.cc.docstrings + echo ""; ./__disna_optim__.bin) > __disna_optim__.cc.docstrings ./munge-texi.pl MFDOCSTRINGS __bfgsmin.cc.docstrings numgradient.cc.docstrings numhessian.cc.docstrings __disna_optim__.cc.docstrings __max_nargin_optim__.cc.docstrings < ../doc/optim.txi > ../doc/optim.texi makeinfo ../doc/optim.texi -o ../doc/optim.info macros.texi:51: warning: redefining Texinfo language command: @seealso CXXFLAGS="-g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection" /usr/bin/mkoctfile --verbose __bfgsmin.cc error-helpers.o CXXFLAGS="-g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection" /usr/bin/mkoctfile --verbose numgradient.cc error-helpers.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __bfgsmin.cc -o /tmp/oct-Op362h.o CXXFLAGS="-g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection" /usr/bin/mkoctfile --verbose numhessian.cc error-helpers.o CXXFLAGS="-g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection" /usr/bin/mkoctfile --verbose \ -llapack -lblas \ __disna_optim__.cc error-helpers.o CXXFLAGS="-g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection" /usr/bin/mkoctfile --verbose __max_nargin_optim__.cc error-helpers.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection numgradient.cc -o /tmp/oct-WHTwMj.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection numhessian.cc -o /tmp/oct-kmlOuz.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __disna_optim__.cc -o /tmp/oct-sErGim.o -g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __max_nargin_optim__.cc -o /tmp/oct-v452N6.o -g++ -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __max_nargin_optim__.oct error-helpers.o /tmp/oct-v452N6.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/x86_64-linux-gnu -shared -Wl,-Bsymbolic -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __disna_optim__.oct error-helpers.o /tmp/oct-sErGim.o -llapack -lblas -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/x86_64-linux-gnu -shared -Wl,-Bsymbolic -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o numhessian.oct error-helpers.o /tmp/oct-kmlOuz.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/x86_64-linux-gnu -shared -Wl,-Bsymbolic -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o numgradient.oct error-helpers.o /tmp/oct-WHTwMj.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/x86_64-linux-gnu -shared -Wl,-Bsymbolic -flto=auto -ffat-lto-objects -Wl,-z,relro -g++ -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __bfgsmin.oct error-helpers.o /tmp/oct-Op362h.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/x86_64-linux-gnu -shared -Wl,-Bsymbolic -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection numgradient.cc -o /tmp/oct-wEjb6O.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __bfgsmin.cc -o /tmp/oct-bxYQ9w.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection numhessian.cc -o /tmp/oct-Fnczco.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __disna_optim__.cc -o /tmp/oct-UjKpIV.o +g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection __max_nargin_optim__.cc -o /tmp/oct-0Zb4YR.o +g++ -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __disna_optim__.oct error-helpers.o /tmp/oct-UjKpIV.o -llapack -lblas -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/x86_64-linux-gnu -shared -Wl,-Bsymbolic -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __max_nargin_optim__.oct error-helpers.o /tmp/oct-0Zb4YR.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/x86_64-linux-gnu -shared -Wl,-Bsymbolic -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o numhessian.oct error-helpers.o /tmp/oct-Fnczco.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/x86_64-linux-gnu -shared -Wl,-Bsymbolic -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o numgradient.oct error-helpers.o /tmp/oct-wEjb6O.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/x86_64-linux-gnu -shared -Wl,-Bsymbolic -flto=auto -ffat-lto-objects -Wl,-z,relro +g++ -I/usr/include/octave-8.4.0/octave/.. -I/usr/include/octave-8.4.0/octave -pthread -fopenmp -g -O2 -ffile-prefix-map=/build/reproducible-path/octave-optim-1.6.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -o __bfgsmin.oct error-helpers.o /tmp/oct-bxYQ9w.o -shared -Wl,-Bsymbolic -Wl,-z,relro -L/usr/lib/x86_64-linux-gnu -shared -Wl,-Bsymbolic -flto=auto -ffat-lto-objects -Wl,-z,relro rm numhessian.bin numgradient.cc.docstrings MFDOCSTRINGS numgradient.bin __disna_optim__.cc.docstrings __disna_optim__.bin numhessian.cc.docstrings __max_nargin_optim__.bin __max_nargin_optim__.cc.docstrings __bfgsmin.bin __bfgsmin.cc.docstrings make[1]: Leaving directory '/build/reproducible-path/octave-optim-1.6.2/src' copyfile /build/reproducible-path/octave-optim-1.6.2/./src/__bfgsmin.oct /build/reproducible-path/octave-optim-1.6.2/./src/__disna_optim__.oct /build/reproducible-path/octave-optim-1.6.2/./src/__max_nargin_optim__.oct /build/reproducible-path/octave-optim-1.6.2/./src/numgradient.oct /build/reproducible-path/octave-optim-1.6.2/./src/numhessian.oct /build/reproducible-path/octave-optim-1.6.2/./inst/x86_64-pc-linux-gnu-api-v58 For information about changes from previous versions of the optim package, run 'news optim'. rm: cannot remove '/build/reproducible-path/octave-optim-1.6.2/debian/octave-optim/usr/share/octave/packages/optim-1.6.2/doc': Is a directory -rm: cannot remove '/build/reproducible-path/octave-optim-1.6.2/debian/octave-optim/usr/share/octave/packages/optim-1.6.2/doc/html': Is a directory rm: cannot remove '/build/reproducible-path/octave-optim-1.6.2/debian/octave-optim/usr/share/octave/packages/optim-1.6.2/doc/development': Is a directory +rm: cannot remove '/build/reproducible-path/octave-optim-1.6.2/debian/octave-optim/usr/share/octave/packages/optim-1.6.2/doc/html': Is a directory debian/rules execute_after_dh_auto_install make[1]: Entering directory '/build/reproducible-path/octave-optim-1.6.2' ( cd src ; ./configure ; make doc ) @@ -3387,21 +3423,21 @@ Checking package... Run the unit tests... Checking m files ... -warning: function /usr/share/octave/packages/statistics-1.6.5/shadow9/var.m shadows a core library function +warning: function /usr/share/octave/packages/statistics-1.6.5/shadow9/mean.m shadows a core library function warning: called from /usr/share/octave/packages/statistics-1.6.5/PKG_ADD at line 15 column 3 load_packages_and_dependencies at line 56 column 5 load_packages at line 53 column 3 pkg at line 639 column 7 - /tmp/tmp.Osl0QMtQMN at line 9 column 9 + /tmp/tmp.XzsPlOCFrc at line 9 column 9 -warning: function /usr/share/octave/packages/statistics-1.6.5/shadow9/std.m shadows a core library function +warning: function /usr/share/octave/packages/statistics-1.6.5/shadow9/median.m shadows a core library function warning: called from /usr/share/octave/packages/statistics-1.6.5/PKG_ADD at line 15 column 3 load_packages_and_dependencies at line 56 column 5 load_packages at line 53 column 3 pkg at line 639 column 7 - /tmp/tmp.Osl0QMtQMN at line 9 column 9 + /tmp/tmp.XzsPlOCFrc at line 9 column 9 warning: function /usr/share/octave/packages/statistics-1.6.5/shadow9/mad.m shadows a core library function warning: called from @@ -3409,51 +3445,48 @@ load_packages_and_dependencies at line 56 column 5 load_packages at line 53 column 3 pkg at line 639 column 7 - /tmp/tmp.Osl0QMtQMN at line 9 column 9 + /tmp/tmp.XzsPlOCFrc at line 9 column 9 -warning: function /usr/share/octave/packages/statistics-1.6.5/shadow9/mean.m shadows a core library function +warning: function /usr/share/octave/packages/statistics-1.6.5/shadow9/std.m shadows a core library function warning: called from /usr/share/octave/packages/statistics-1.6.5/PKG_ADD at line 15 column 3 load_packages_and_dependencies at line 56 column 5 load_packages at line 53 column 3 pkg at line 639 column 7 - /tmp/tmp.Osl0QMtQMN at line 9 column 9 + /tmp/tmp.XzsPlOCFrc at line 9 column 9 -warning: function /usr/share/octave/packages/statistics-1.6.5/shadow9/median.m shadows a core library function +warning: function /usr/share/octave/packages/statistics-1.6.5/shadow9/var.m shadows a core library function warning: called from /usr/share/octave/packages/statistics-1.6.5/PKG_ADD at line 15 column 3 load_packages_and_dependencies at line 56 column 5 load_packages at line 53 column 3 pkg at line 639 column 7 - /tmp/tmp.Osl0QMtQMN at line 9 column 9 + /tmp/tmp.XzsPlOCFrc at line 9 column 9 -[inst/nonlin_min.m] ->>>>> /build/reproducible-path/octave-optim-1.6.2/inst/nonlin_min.m +[inst/fmincon.m] +>>>>> /build/reproducible-path/octave-optim-1.6.2/inst/fmincon.m ***** demo ## Example for default optimization (Levenberg/Marquardt with ## BFGS), one non-linear equality constraint. Constrained optimum is ## at p = [0; 1]. objective_function = @ (p) p(1)^2 + p(2)^2; pin = [-2; 5]; + constraint_function = @ (p) - (p(1)^2 + 1 - p(2)); + [p, objf, cvg, outp] = fmincon (objective_function, pin, [], [], [], [], [], [], @ (p) {[], constraint_function(p)}{:}) +***** test + ## equality constraint + objective_function = @ (p) p(1)^2 + p(2)^2; + pin = [-2; 5]; + constraint_function = @ (p) - (p(1)^2 + 1 - p(2)); + [p, objf, cvg, outp] = fmincon (objective_function, pin, [], [], [], [], [], [], @ (p) {[], constraint_function(p)}{:}, optimset ("Algorithm", "lm_feasible")); + assert (p, [0; 1], 1e-6) +***** test + ## inequality constraint + objective_function = @ (p) p(1)^2 + p(2)^2; + pin = [2; 6]; constraint_function = @ (p) p(1)^2 + 1 - p(2); - [p, objf, cvg, outp] = nonlin_min (objective_function, pin, optimset ("equc", {constraint_function})) -***** demo - ## Example for simulated annealing, two parameters, "trace_steps" - ## is true; - t_init = .2; - t_min = .002; - mu_t = 1.002; - iters_fixed_t = 10; - init_p = [2; 2]; - max_rand_step = [.2; .2]; - [p, objf, cvg, outp] = nonlin_min (@ (p) (p(1)/10)^2 + (p(2)/10)^2 + .1 * (-cos(4*p(1)) - cos(4*p(2))), init_p, optimset ("algorithm", "siman", "max_rand_step", max_rand_step, "t_init", t_init, "T_min", t_min, "mu_t", mu_t, "iters_fixed_T", iters_fixed_t, "trace_steps", true)); - p - objf - x = (outp.trace(:, 1) - 1) * iters_fixed_t + outp.trace(:, 2); - x(1) = 0; - plot (x, cat (2, outp.trace(:, 3:end), t_init ./ (mu_t .^ outp.trace(:, 1)))) - legend ({"objective function value", "p(1)", "p(2)", "Temperature"}) - xlabel ("subiteration") + [p, objf, cvg, outp] = fmincon (objective_function, pin, [], [], [], [], [], [], @ (p) {constraint_function(p), []}{:}, optimset ("Algorithm", "lm_feasible")); + assert (p, [0; 1], 1e-6) ***** test ## independents indep = 1:5; @@ -3461,13 +3494,138 @@ f = @ (p) sumsq (p(1) * exp (p(2) * indep) - [1, 2, 4, 7, 14]); ## initial values: init = [.25; .25]; - ## linear constraints, A.' * parametervector + B >= 0 - A = [1; -1]; B = 0; # p(1) >= p(2); - settings = optimset ("inequc", {A, B}); + ## linear constraints, A * parametervector + B >= 0 + A = [1, -1]; B = 0; # p(1) >= p(2); - assert (nonlin_min (f, init, settings), [.6203; .6203], .0001); + assert (fmincon (f, init, -A, B), [.6203; .6203], .0001); ***** test -***** shared x, misc + ## problem structure + indep = 1:5; + problem = struct ("objective", + @ (p) sumsq (p(1) * exp (p(2) * indep) - [1, 2, 4, 7, 14]), + "x0", [.25; .25], + "Aineq", [-1, 1], + "bineq", 0, + "solver", "fmincon"); + assert (fmincon (problem), [.6203; .6203], .0001); +***** test + ## Octave sqp solver with a lot of inequality constraints + objf = @ (p) sumsq (p(4:9)); + init = [300; -100; -.1997; -127; -151; 379; 421; 460; 426]; + lbound = [-Inf; -Inf; -Inf; 0; 0; 0; 0; 0; 0]; + inequc = @ (p) vertcat ( ... + p(1) + p(2) * exp (-5 * p(3)) + p(4) - 127, + p(1) + p(2) * exp (-3 * p(3)) + p(5) - 151, + p(1) + p(2) * exp (-p(3)) + p(6) - 379, + p(1) + p(2) * exp (p(3)) + p(7) - 421, + p(1) + p(2) * exp (3 * p(3)) + p(8) - 460, + p(1) + p(2) * exp (5 * p(3)) + p(9) - 426, + -p(1) - p(2) * exp (-5 * p(3)) + p(4) + 127, + -p(1) - p(2) * exp (-3 * p(3)) + p(5) + 151, + -p(1) - p(2) * exp (-p(3)) + p(6) + 379, + -p(1) - p(2) * exp (p(3)) + p(7) + 421, + -p(1) - p(2) * exp (3 * p(3)) + p(8) + 460, + -p(1) - p(2) * exp (5 * p(3)) + p(9) + 426); + [p, objf, cvg, outp] = fmincon (objf, init, [], [], [], [], lbound, [], + @ (p) {- inequc(p), []}{:}, + optimset ("Algorithm", "octave_sqp")); + assert (p, [5.2330e+02; -1.5694e+02; -1.9966e-01; 2.9607e+01; + 8.6615e+01; 4.7326e+01; 2.6235e+01; 2.2915e+01; + 3.9470e+01], .01); +***** test + ## Same as above with re-ordered parameters to test bound vectors + ## with less elements than parameters. + objf = @ (p) sumsq (p(1:6)); + init = [-127; -151; 379; 421; 460; 426; 300; -100; -.1997]; + lbound = [0; 0; 0; 0; 0; 0]; + inequc = @ (p) vertcat ( ... + p(7) + p(8) * exp (-5 * p(9)) + p(1) - 127, + p(7) + p(8) * exp (-3 * p(9)) + p(2) - 151, + p(7) + p(8) * exp (-p(9)) + p(3) - 379, + p(7) + p(8) * exp (p(9)) + p(4) - 421, + p(7) + p(8) * exp (3 * p(9)) + p(5) - 460, + p(7) + p(8) * exp (5 * p(9)) + p(6) - 426, + -p(7) - p(8) * exp (-5 * p(9)) + p(1) + 127, + -p(7) - p(8) * exp (-3 * p(9)) + p(2) + 151, + -p(7) - p(8) * exp (-p(9)) + p(3) + 379, + -p(7) - p(8) * exp (p(9)) + p(4) + 421, + -p(7) - p(8) * exp (3 * p(9)) + p(5) + 460, + -p(7) - p(8) * exp (5 * p(9)) + p(6) + 426); + [p, objf, cvg, outp] = fmincon (objf, init, [], [], [], [], lbound, [], + @ (p) {- inequc(p), []}{:}, + optimset ("Algorithm", "octave_sqp")); + assert (p, [2.9607e+01; 8.6615e+01; 4.7326e+01; 2.6235e+01; + 2.2915e+01; 3.9470e+01; 5.2330e+02; -1.5694e+02; + -1.9966e-01], .01); +6 tests, 6 passed, 0 known failure, 0 skipped +[inst/de_min.m] +>>>>> /build/reproducible-path/octave-optim-1.6.2/inst/de_min.m +***** function result = f(x); + result = 100 * (x(2) - x(1)^2)^2 + (1 - x(1))^2; +***** test + tol = 1.0e-4; + ctl.tol = 0.0; + ctl.VTR = 1.0e-6; + ctl.XVmin = [-2 -2]; + ctl.XVmax = [ 2 2]; + rand("state", 11) + [x, obj_value, nfeval, convergence] = de_min (@f, ctl); + assert (convergence == 1); + assert (f(x) == obj_value); + assert (obj_value < ctl.VTR); +***** demo + ## define a simple example function + f = @(x) peaks(x(1), x(2)); + ## plot the function to see where the minimum might be + peaks() + ## first we set the region where we expect the minimum + ctl.XVmin = [-3 -3]; + ctl.XVmax = [ 3 3]; + ## and solve it with de_min + [x, obj_value, nfeval, convergence] = de_min (f, ctl) +1 test, 1 passed, 0 known failure, 0 skipped +[inst/__all_stat_opts__.m] +>>>>> /build/reproducible-path/octave-optim-1.6.2/inst/__all_stat_opts__.m +***** assert (1) +1 test, 1 passed, 0 known failure, 0 skipped +[inst/residmin_stat.m] +>>>>> /build/reproducible-path/octave-optim-1.6.2/inst/residmin_stat.m +***** test + ## independents + indep = 1:5; + ## residual function: + f = @ (p) p(1) * exp (p(2) * indep) - [1, 2, 4, 7, 14]; + ## parameters: + p = [.53203; .65307]; + + settings = optimset ("objf_type", "wls", + "ret_dfdp", true, "ret_covd", true, + "ret_covp", true, "ret_corp", true); + + info = residmin_stat (f, p, settings); + + assert (info.corp, [1, -.98918; -.98918, 1], .0001); +***** test + ## independents + indep = 1:5; + ## residual function: + f = @ (p) p(1) * exp (p(2) * indep) - [1, 2, 4, 7, 14]; + ## parameters: + p = single ([.53203; .65307]); + + settings = optimset ("objf_type", "wls", + "ret_dfdp", true, "ret_covd", true, + "ret_covp", true, "ret_corp", true); + + info = residmin_stat (f, p, settings); + + assert (info.corp, [1, -.98918; -.98918, 1], .0001); + assert (isa (info.dfdp, "single")); + assert (isa (info.covd, "single")); + assert (isa (info.covp, "single")); + assert (isa (info.corp, "single")); +***** test +***** shared x, misc, corp x = [.871, .643, .550; .228, .669, .854; .528, .229, .170; @@ -3510,47 +3668,51 @@ 4.95, 4.08, 4.19; 2.96, 4.26, 4.48]; - pin = struct ("a", .1 * ones (3, 1), "b", .1, "c", .1, "d", 1); + corp = [1.000000, -0.396899, -0.402479, -0.019351, -0.167128; + -0.396899, 1.000000, -0.462988, -0.053813, 0.214705; + -0.402479, -0.462988, 1.000000, 0.127128, -0.187121; + -0.019351, -0.053813, 0.127128, 1.000000, -0.035904; + -0.167128, 0.214705, -0.187121, -0.035904, 1.000000]; - pconf.a.lbound = [-Inf, 0, NA]; + p = struct ("a", [.9925145; 2.005293; 3.999732], + "b", 2.680371, "c", .4977683); + + pconf.a.TypicalX = .5 * ones (3, 1); + pconf.a. diffp = [.0001; .00001; .0001]; pconf.b.diff_onesided = true; - pconf.b.lbound = 0; - pconf.c.ubound = .3; - pconf.d.fixed = true; - settings = optimset ("param_config", pconf, "objf_pstruct", true); + settings = optimset ("param_config", pconf, "f_pstruct", true, + "objf_type", "wls", + "ret_dfdp", true, "ret_covd", true, + "ret_covp", true, "ret_corp", true); - f = @ (p) sumsq (( ... + f = @ (p) ... subsasgn (x, struct ("type", "()", "subs", {{9, 3}}), p.c) ... * horzcat (p.a, p.a([3, 1, 2]), p.a([3, 2, 1])) ... - - p.d ... - * subsasgn (misc, struct ("type", "()", "subs", {{3, 2}}), p.b))(:)); + - subsasgn (misc, struct ("type", "()", "subs", {{3, 2}}), p.b); - [p, ~, ~, outp] = nonlin_min (f, pin, settings); + info = residmin_stat (f, p, settings); - assert (p.a, [1.0590; 1.9266; 4.0456], .005); - assert (p.b, 2.7061, .005); - assert (p.c, .3, .000001); - assert (p.d, 1); + assert (info.corp, corp, .0001); ***** test - pin = zeros (6, 1); - pin(6) = 1; + p = [.9925145; 2.005293; 3.999732; 2.680371; .4977683]; - settings = optimset ("lbound", [-Inf; 0; NA; 0; -Inf; -Inf], - "ubound", [Inf; Inf; Inf; Inf; .3; Inf], + settings = optimset ("TypicalX", .5, + "diffp", [.0001; .00001; .0001; .00001; .0001], "diff_onesided", true, - "fixed", [false; false; false; false; false; true]); + "objf_type", "wls", + "ret_dfdp", true, "ret_covd", true, + "ret_covp", true, "ret_corp", true); - f = @ (p) sumsq (( ... + f = @ (p) ... subsasgn (x, struct ("type", "()", "subs", {{9, 3}}), p(5)) ... * horzcat (p([1, 2, 3]), p([3, 1, 2]), p([3, 2, 1])) ... - - p(6) ... - * subsasgn (misc, struct ("type", "()", "subs", {{3, 2}}), p(4)))(:)); + - subsasgn (misc, struct ("type", "()", "subs", {{3, 2}}), p(4)); - p = nonlin_min (f, pin, settings); + info = residmin_stat (f, p, settings); - assert (p, [1.0590; 1.9266; 4.0456; 2.7061; .3; 1], .005); -3 tests, 3 passed, 0 known failure, 0 skipped + assert (info.corp, corp, .0001); +4 tests, 4 passed, 0 known failure, 0 skipped [inst/lsqnonlin.m] >>>>> /build/reproducible-path/octave-optim-1.6.2/inst/lsqnonlin.m ***** test @@ -3601,116 +3763,6 @@ [c, resnorm, residual, flag, output, lambda, jacob] = ... lsqnonlin(@(p) myfun(p, x, y), p0, lb, ub, opts) 2 tests, 2 passed, 0 known failure, 0 skipped -[inst/statget.m] ->>>>> /build/reproducible-path/octave-optim-1.6.2/inst/statget.m -***** shared opts - opts = statset ("maxit", 100); -***** assert (statget (opts, "maxit"), 100) -***** assert (statget (opts, "MaxITer"), 100) -***** assert (statget (opts, "TolFun"), []) -***** assert (statget (opts, "TolFun", 1e-3), 1e-3) -***** error statget () -***** error statget (1) -***** error statget (1,2,3,4,5) -***** error statget (1, "name") -***** error statget (struct (), 2) -9 tests, 9 passed, 0 known failure, 0 skipped -[inst/statset.m] ->>>>> /build/reproducible-path/octave-optim-1.6.2/inst/statset.m -***** assert (isfield (statset (), "TolFun")) -***** assert (isfield (statset ("tolFun", 1e-3), "TolFun")) -***** error statset ("1_Parameter") -***** error statset ("%NOT_A_REAL_FUNCTION_NAME%") -***** warning statset ("foobar", 13); -5 tests, 5 passed, 0 known failure, 0 skipped -[inst/lsqlin.m] ->>>>> /build/reproducible-path/octave-optim-1.6.2/inst/lsqlin.m -***** test -***** shared C,d,A,b - C = [0.9501,0.7620,0.6153,0.4057;... - 0.2311,0.4564,0.7919,0.9354;... - 0.6068,0.0185,0.9218,0.9169;... - 0.4859,0.8214,0.7382,0.4102;... - 0.8912,0.4447,0.1762,0.8936]; - d = [0.0578; 0.3528; 0.8131; 0.0098; 0.1388]; - A =[0.2027, 0.2721, 0.7467, 0.4659;... - 0.1987, 0.1988, 0.4450, 0.4186;... - 0.6037 , 0.0152, 0.9318, 0.8462]; - b =[0.5251;0.2026;0.6721]; - Aeq = [3, 5, 7, 9]; - beq = 4; - lb = -0.1*ones(4,1); - ub = 2*ones(4,1); - [x,resnorm,residual,exitflag] = lsqlin(C,d,A,b,Aeq,beq,lb,ub); - assert(x,[-0.10000; -0.10000; 0.15991; 0.40896],10e-5) - assert(resnorm,0.16951,10e-5) - assert(residual, [0.035297; 0.087623; -0.353251; 0.145270; 0.121232],10e-5) - assert(exitflag,1) -***** test - Aeq = []; - beq = []; - lb = []; - ub = []; - x0 = 0.1*ones(4,1); - x = lsqlin(C,d,A,b,Aeq,beq,lb,ub,x0); - [x,resnorm,residual,exitflag] = lsqlin(C,d,A,b,Aeq,beq,lb,ub,x0); - assert(x,[ 0.12986; -0.57569 ; 0.42510; 0.24384],10e-5) - assert(resnorm,0.017585,10e-5) - assert(residual, [-0.0126033; -0.0208040; -0.1295084; -0.0057389; 0.01372462],10e-5) - assert(exitflag,1) -***** demo - C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; - d = [0.0578; 0.3528; 0.8131; 0.0098; 0.1388]; - %% Linear Inequality Constraints - A =[0.2027 0.2721 0.7467 0.4659 - 0.1987 0.1988 0.4450 0.4186 - 0.6037 0.0152 0.9318 0.8462]; - b =[0.5251; 0.2026; 0.6721]; - %% Linear Equality Constraints - Aeq = [3 5 7 9]; - beq = 4; - %% Bound constraints - lb = -0.1*ones(4,1); - ub = ones(4,1); - [x, resnorm, residual, flag, output, lambda] = lsqlin (C, d, A, b, Aeq, beq, lb, ub) -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/nlinfit.m] ->>>>> /build/reproducible-path/octave-optim-1.6.2/inst/nlinfit.m -***** test - modelfun = @(b, x) (b(1) + b(2) * exp (- b(3) * x)); - b = [1;3;2]; - v = rande ("state"); - rande ("seed", 1234); - xdata = exprnd (2,100,1); - rande ("state", v); - v = randn ("state"); - randn ("seed", 1234); - ydata = modelfun (b,xdata) + normrnd (0,0.1,100,1); - randn ("state", v); - beta0 = [2;2;3]; - beta = nlinfit(xdata,ydata,modelfun,beta0); - assert (beta, [1;3;2], 1e-1) -***** demo - modelfun = @(b, x) (b(1) + b(2) * exp (- b(3) * x)); - %% actual value - beta_without_noise = [1; 3; 2]; - x = [3.49622; 0.33751; 1.25675; 3.66981; 0.26237; 5.51095; ... - 2.11407; 1.48774; 6.22436; 2.04519]; - y_actual = modelfun (beta_without_noise, x); - noise = [0.176110; -0.066850; 0.231000; -0.047570; -0.108230; ... - 0.122790; 0.062940; 0.151510; 0.116010; -0.097460]; - y_noisy = y_actual + noise; - %% initial guess - beta0 = [2; 2; 2]; - %% weights vector - weights = [5; 16; 1; 20; 12; 11; 17; 8; 11; 13]; - [beta, R, J, covb, mse] = nlinfit (x, y_noisy, modelfun, beta0) - [beta_w, R_w, J_w, covb_w, mse_w] = nlinfit (x, y_noisy, modelfun, beta0, [], "weights", weights) -1 test, 1 passed, 0 known failure, 0 skipped [inst/lsqcurvefit.m] >>>>> /build/reproducible-path/octave-optim-1.6.2/inst/lsqcurvefit.m ***** test @@ -3761,44 +3813,61 @@ [c, resnorm, residual, flag, output, lambda, jacob] = ... lsqcurvefit (@ (varargin) myfun(varargin{:}), p0, x, y, lb, ub, opts) 2 tests, 2 passed, 0 known failure, 0 skipped -[inst/residmin_stat.m] ->>>>> /build/reproducible-path/octave-optim-1.6.2/inst/residmin_stat.m +[inst/statset.m] +>>>>> /build/reproducible-path/octave-optim-1.6.2/inst/statset.m +***** assert (isfield (statset (), "TolFun")) +***** assert (isfield (statset ("tolFun", 1e-3), "TolFun")) +***** error statset ("1_Parameter") +***** error statset ("%NOT_A_REAL_FUNCTION_NAME%") +***** warning statset ("foobar", 13); +5 tests, 5 passed, 0 known failure, 0 skipped +[inst/nonlin_residmin.m] +>>>>> /build/reproducible-path/octave-optim-1.6.2/inst/nonlin_residmin.m +***** demo + ## Example for linear inequality constraints + ## (see also the same example in 'demo nonlin_curvefit') + + ## independents + indep = 1:5; + ## residual function: + f = @ (p) p(1) * exp (p(2) * indep) - [1, 2, 4, 7, 14]; + ## initial values: + init = [.25; .25]; + ## linear constraints, A.' * parametervector + B >= 0 + A = [1; -1]; B = 0; # p(1) >= p(2); + settings = optimset ("inequc", {A, B}); + + ## start optimization + [p, residuals, cvg, outp] = nonlin_residmin (f, init, settings) ***** test ## independents indep = 1:5; ## residual function: f = @ (p) p(1) * exp (p(2) * indep) - [1, 2, 4, 7, 14]; - ## parameters: - p = [.53203; .65307]; - - settings = optimset ("objf_type", "wls", - "ret_dfdp", true, "ret_covd", true, - "ret_covp", true, "ret_corp", true); - - info = residmin_stat (f, p, settings); + ## initial values: + init = [.25; .25]; + ## linear constraints, A.' * parametervector + B >= 0 + A = [1; -1]; B = 0; # p(1) >= p(2); + settings = optimset ("inequc", {A, B}); - assert (info.corp, [1, -.98918; -.98918, 1], .0001); + assert (nonlin_residmin (f, init, settings), [.6203; .6203], .0001); ***** test ## independents indep = 1:5; ## residual function: f = @ (p) p(1) * exp (p(2) * indep) - [1, 2, 4, 7, 14]; - ## parameters: - p = single ([.53203; .65307]); - - settings = optimset ("objf_type", "wls", - "ret_dfdp", true, "ret_covd", true, - "ret_covp", true, "ret_corp", true); - - info = residmin_stat (f, p, settings); + ## initial values: + init = single ([.25; .25]); + ## linear constraints, A.' * parametervector + B >= 0 + A = [1; -1]; B = 0; # p(1) >= p(2); + settings = optimset ("inequc", {A, B}, + "complex_step_derivative_f", true); - assert (info.corp, [1, -.98918; -.98918, 1], .0001); - assert (isa (info.dfdp, "single")); - assert (isa (info.covd, "single")); - assert (isa (info.covp, "single")); - assert (isa (info.corp, "single")); + result = nonlin_residmin (f, init, settings); + assert (result, [.6203; .6203], .0001); + assert (isa (result, "single")); ***** test -***** shared x, misc, corp +***** shared x, misc x = [.871, .643, .550; .228, .669, .854; .528, .229, .170; @@ -3841,101 +3910,82 @@ 4.95, 4.08, 4.19; 2.96, 4.26, 4.48]; - corp = [1.000000, -0.396899, -0.402479, -0.019351, -0.167128; - -0.396899, 1.000000, -0.462988, -0.053813, 0.214705; - -0.402479, -0.462988, 1.000000, 0.127128, -0.187121; - -0.019351, -0.053813, 0.127128, 1.000000, -0.035904; - -0.167128, 0.214705, -0.187121, -0.035904, 1.000000]; - - p = struct ("a", [.9925145; 2.005293; 3.999732], - "b", 2.680371, "c", .4977683); + pin = struct ("a", .1 * ones (3, 1), "b", .1, "c", .1, "d", 1); - pconf.a.TypicalX = .5 * ones (3, 1); - pconf.a. diffp = [.0001; .00001; .0001]; + pconf.a.lbound = [-Inf, 0, NA]; pconf.b.diff_onesided = true; + pconf.b.lbound = 0; + pconf.c.ubound = .3; + pconf.d.fixed = true; - settings = optimset ("param_config", pconf, "f_pstruct", true, - "objf_type", "wls", - "ret_dfdp", true, "ret_covd", true, - "ret_covp", true, "ret_corp", true); + settings = optimset ("param_config", pconf, "f_pstruct", true); f = @ (p) ... subsasgn (x, struct ("type", "()", "subs", {{9, 3}}), p.c) ... * horzcat (p.a, p.a([3, 1, 2]), p.a([3, 2, 1])) ... - - subsasgn (misc, struct ("type", "()", "subs", {{3, 2}}), p.b); + - p.d * subsasgn (misc, struct ("type", "()", "subs", {{3, 2}}), p.b); - info = residmin_stat (f, p, settings); + [p, ~, ~, outp] = nonlin_residmin (f, pin, settings); - assert (info.corp, corp, .0001); + assert (p.a, [1.0590; 1.9266; 4.0456], .0001); + assert (p.b, 2.7061, .0001); + assert (p.c, .3, .000001); + assert (p.d, 1); + assert (isempty (outp.lambda.ineqlin)); + assert (isempty (outp.lambda.eqlin)); + assert (isempty (outp.lambda.ineqnonlin)); + assert (isempty (outp.lambda.eqnonlin)); + assert (! any (outp.lambda.lower.a)); + assert (! outp.lambda.lower.b); + assert (! outp.lambda.lower.c); + assert (! any (outp.lambda.upper.a)); + assert (! outp.lambda.upper.b); + assert (outp.lambda.upper.c > 0); ***** test - p = [.9925145; 2.005293; 3.999732; 2.680371; .4977683]; + pin = zeros (6, 1); + pin(6) = 1; - settings = optimset ("TypicalX", .5, - "diffp", [.0001; .00001; .0001; .00001; .0001], + settings = optimset ("lbound", [-Inf; 0; NA; 0; -Inf; -Inf], + "ubound", [Inf; Inf; Inf; Inf; .3; Inf], "diff_onesided", true, - "objf_type", "wls", - "ret_dfdp", true, "ret_covd", true, - "ret_covp", true, "ret_corp", true); + "fixed", [false; false; false; false; false; true]); f = @ (p) ... subsasgn (x, struct ("type", "()", "subs", {{9, 3}}), p(5)) ... * horzcat (p([1, 2, 3]), p([3, 1, 2]), p([3, 2, 1])) ... - - subsasgn (misc, struct ("type", "()", "subs", {{3, 2}}), p(4)); + - p(6) * subsasgn (misc, struct ("type", "()", "subs", {{3, 2}}), p(4)); - info = residmin_stat (f, p, settings); + p = nonlin_residmin (f, pin, settings); - assert (info.corp, corp, .0001); + assert (p, [1.0590; 1.9266; 4.0456; 2.7061; .3; 1], .0001); 4 tests, 4 passed, 0 known failure, 0 skipped -[inst/de_min.m] ->>>>> /build/reproducible-path/octave-optim-1.6.2/inst/de_min.m -***** function result = f(x); - result = 100 * (x(2) - x(1)^2)^2 + (1 - x(1))^2; -***** test - tol = 1.0e-4; - ctl.tol = 0.0; - ctl.VTR = 1.0e-6; - ctl.XVmin = [-2 -2]; - ctl.XVmax = [ 2 2]; - rand("state", 11) - [x, obj_value, nfeval, convergence] = de_min (@f, ctl); - assert (convergence == 1); - assert (f(x) == obj_value); - assert (obj_value < ctl.VTR); -***** demo - ## define a simple example function - f = @(x) peaks(x(1), x(2)); - ## plot the function to see where the minimum might be - peaks() - ## first we set the region where we expect the minimum - ctl.XVmin = [-3 -3]; - ctl.XVmax = [ 3 3]; - ## and solve it with de_min - [x, obj_value, nfeval, convergence] = de_min (f, ctl) -1 test, 1 passed, 0 known failure, 0 skipped -[inst/fmincon.m] ->>>>> /build/reproducible-path/octave-optim-1.6.2/inst/fmincon.m +[inst/nonlin_min.m] +>>>>> /build/reproducible-path/octave-optim-1.6.2/inst/nonlin_min.m ***** demo ## Example for default optimization (Levenberg/Marquardt with ## BFGS), one non-linear equality constraint. Constrained optimum is ## at p = [0; 1]. objective_function = @ (p) p(1)^2 + p(2)^2; pin = [-2; 5]; - constraint_function = @ (p) - (p(1)^2 + 1 - p(2)); - [p, objf, cvg, outp] = fmincon (objective_function, pin, [], [], [], [], [], [], @ (p) {[], constraint_function(p)}{:}) -***** test - ## equality constraint - objective_function = @ (p) p(1)^2 + p(2)^2; - pin = [-2; 5]; - constraint_function = @ (p) - (p(1)^2 + 1 - p(2)); - [p, objf, cvg, outp] = fmincon (objective_function, pin, [], [], [], [], [], [], @ (p) {[], constraint_function(p)}{:}, optimset ("Algorithm", "lm_feasible")); - assert (p, [0; 1], 1e-6) -***** test - ## inequality constraint - objective_function = @ (p) p(1)^2 + p(2)^2; - pin = [2; 6]; constraint_function = @ (p) p(1)^2 + 1 - p(2); - [p, objf, cvg, outp] = fmincon (objective_function, pin, [], [], [], [], [], [], @ (p) {constraint_function(p), []}{:}, optimset ("Algorithm", "lm_feasible")); - assert (p, [0; 1], 1e-6) + [p, objf, cvg, outp] = nonlin_min (objective_function, pin, optimset ("equc", {constraint_function})) +***** demo + ## Example for simulated annealing, two parameters, "trace_steps" + ## is true; + t_init = .2; + t_min = .002; + mu_t = 1.002; + iters_fixed_t = 10; + init_p = [2; 2]; + max_rand_step = [.2; .2]; + [p, objf, cvg, outp] = nonlin_min (@ (p) (p(1)/10)^2 + (p(2)/10)^2 + .1 * (-cos(4*p(1)) - cos(4*p(2))), init_p, optimset ("algorithm", "siman", "max_rand_step", max_rand_step, "t_init", t_init, "T_min", t_min, "mu_t", mu_t, "iters_fixed_T", iters_fixed_t, "trace_steps", true)); + p + objf + x = (outp.trace(:, 1) - 1) * iters_fixed_t + outp.trace(:, 2); + x(1) = 0; + plot (x, cat (2, outp.trace(:, 3:end), t_init ./ (mu_t .^ outp.trace(:, 1)))) + legend ({"objective function value", "p(1)", "p(2)", "Temperature"}) + xlabel ("subiteration") ***** test ## independents indep = 1:5; @@ -3943,115 +3993,11 @@ f = @ (p) sumsq (p(1) * exp (p(2) * indep) - [1, 2, 4, 7, 14]); ## initial values: init = [.25; .25]; - ## linear constraints, A * parametervector + B >= 0 - A = [1, -1]; B = 0; # p(1) >= p(2); - - assert (fmincon (f, init, -A, B), [.6203; .6203], .0001); -***** test - ## problem structure - indep = 1:5; - problem = struct ("objective", - @ (p) sumsq (p(1) * exp (p(2) * indep) - [1, 2, 4, 7, 14]), - "x0", [.25; .25], - "Aineq", [-1, 1], - "bineq", 0, - "solver", "fmincon"); - assert (fmincon (problem), [.6203; .6203], .0001); -***** test - ## Octave sqp solver with a lot of inequality constraints - objf = @ (p) sumsq (p(4:9)); - init = [300; -100; -.1997; -127; -151; 379; 421; 460; 426]; - lbound = [-Inf; -Inf; -Inf; 0; 0; 0; 0; 0; 0]; - inequc = @ (p) vertcat ( ... - p(1) + p(2) * exp (-5 * p(3)) + p(4) - 127, - p(1) + p(2) * exp (-3 * p(3)) + p(5) - 151, - p(1) + p(2) * exp (-p(3)) + p(6) - 379, - p(1) + p(2) * exp (p(3)) + p(7) - 421, - p(1) + p(2) * exp (3 * p(3)) + p(8) - 460, - p(1) + p(2) * exp (5 * p(3)) + p(9) - 426, - -p(1) - p(2) * exp (-5 * p(3)) + p(4) + 127, - -p(1) - p(2) * exp (-3 * p(3)) + p(5) + 151, - -p(1) - p(2) * exp (-p(3)) + p(6) + 379, - -p(1) - p(2) * exp (p(3)) + p(7) + 421, - -p(1) - p(2) * exp (3 * p(3)) + p(8) + 460, - -p(1) - p(2) * exp (5 * p(3)) + p(9) + 426); - [p, objf, cvg, outp] = fmincon (objf, init, [], [], [], [], lbound, [], - @ (p) {- inequc(p), []}{:}, - optimset ("Algorithm", "octave_sqp")); - assert (p, [5.2330e+02; -1.5694e+02; -1.9966e-01; 2.9607e+01; - 8.6615e+01; 4.7326e+01; 2.6235e+01; 2.2915e+01; - 3.9470e+01], .01); -***** test - ## Same as above with re-ordered parameters to test bound vectors - ## with less elements than parameters. - objf = @ (p) sumsq (p(1:6)); - init = [-127; -151; 379; 421; 460; 426; 300; -100; -.1997]; - lbound = [0; 0; 0; 0; 0; 0]; - inequc = @ (p) vertcat ( ... - p(7) + p(8) * exp (-5 * p(9)) + p(1) - 127, - p(7) + p(8) * exp (-3 * p(9)) + p(2) - 151, - p(7) + p(8) * exp (-p(9)) + p(3) - 379, - p(7) + p(8) * exp (p(9)) + p(4) - 421, - p(7) + p(8) * exp (3 * p(9)) + p(5) - 460, - p(7) + p(8) * exp (5 * p(9)) + p(6) - 426, - -p(7) - p(8) * exp (-5 * p(9)) + p(1) + 127, - -p(7) - p(8) * exp (-3 * p(9)) + p(2) + 151, - -p(7) - p(8) * exp (-p(9)) + p(3) + 379, - -p(7) - p(8) * exp (p(9)) + p(4) + 421, - -p(7) - p(8) * exp (3 * p(9)) + p(5) + 460, - -p(7) - p(8) * exp (5 * p(9)) + p(6) + 426); - [p, objf, cvg, outp] = fmincon (objf, init, [], [], [], [], lbound, [], - @ (p) {- inequc(p), []}{:}, - optimset ("Algorithm", "octave_sqp")); - assert (p, [2.9607e+01; 8.6615e+01; 4.7326e+01; 2.6235e+01; - 2.2915e+01; 3.9470e+01; 5.2330e+02; -1.5694e+02; - -1.9966e-01], .01); -6 tests, 6 passed, 0 known failure, 0 skipped -[inst/nonlin_residmin.m] ->>>>> /build/reproducible-path/octave-optim-1.6.2/inst/nonlin_residmin.m -***** demo - ## Example for linear inequality constraints - ## (see also the same example in 'demo nonlin_curvefit') - - ## independents - indep = 1:5; - ## residual function: - f = @ (p) p(1) * exp (p(2) * indep) - [1, 2, 4, 7, 14]; - ## initial values: - init = [.25; .25]; - ## linear constraints, A.' * parametervector + B >= 0 - A = [1; -1]; B = 0; # p(1) >= p(2); - settings = optimset ("inequc", {A, B}); - - ## start optimization - [p, residuals, cvg, outp] = nonlin_residmin (f, init, settings) -***** test - ## independents - indep = 1:5; - ## residual function: - f = @ (p) p(1) * exp (p(2) * indep) - [1, 2, 4, 7, 14]; - ## initial values: - init = [.25; .25]; ## linear constraints, A.' * parametervector + B >= 0 A = [1; -1]; B = 0; # p(1) >= p(2); settings = optimset ("inequc", {A, B}); - assert (nonlin_residmin (f, init, settings), [.6203; .6203], .0001); -***** test - ## independents - indep = 1:5; - ## residual function: - f = @ (p) p(1) * exp (p(2) * indep) - [1, 2, 4, 7, 14]; - ## initial values: - init = single ([.25; .25]); - ## linear constraints, A.' * parametervector + B >= 0 - A = [1; -1]; B = 0; # p(1) >= p(2); - settings = optimset ("inequc", {A, B}, - "complex_step_derivative_f", true); - - result = nonlin_residmin (f, init, settings); - assert (result, [.6203; .6203], .0001); - assert (isa (result, "single")); + assert (nonlin_min (f, init, settings), [.6203; .6203], .0001); ***** test ***** shared x, misc x = [.871, .643, .550; @@ -4104,29 +4050,20 @@ pconf.c.ubound = .3; pconf.d.fixed = true; - settings = optimset ("param_config", pconf, "f_pstruct", true); + settings = optimset ("param_config", pconf, "objf_pstruct", true); - f = @ (p) ... + f = @ (p) sumsq (( ... subsasgn (x, struct ("type", "()", "subs", {{9, 3}}), p.c) ... * horzcat (p.a, p.a([3, 1, 2]), p.a([3, 2, 1])) ... - - p.d * subsasgn (misc, struct ("type", "()", "subs", {{3, 2}}), p.b); + - p.d ... + * subsasgn (misc, struct ("type", "()", "subs", {{3, 2}}), p.b))(:)); - [p, ~, ~, outp] = nonlin_residmin (f, pin, settings); + [p, ~, ~, outp] = nonlin_min (f, pin, settings); - assert (p.a, [1.0590; 1.9266; 4.0456], .0001); - assert (p.b, 2.7061, .0001); + assert (p.a, [1.0590; 1.9266; 4.0456], .005); + assert (p.b, 2.7061, .005); assert (p.c, .3, .000001); assert (p.d, 1); - assert (isempty (outp.lambda.ineqlin)); - assert (isempty (outp.lambda.eqlin)); - assert (isempty (outp.lambda.ineqnonlin)); - assert (isempty (outp.lambda.eqnonlin)); - assert (! any (outp.lambda.lower.a)); - assert (! outp.lambda.lower.b); - assert (! outp.lambda.lower.c); - assert (! any (outp.lambda.upper.a)); - assert (! outp.lambda.upper.b); - assert (outp.lambda.upper.c > 0); ***** test pin = zeros (6, 1); pin(6) = 1; @@ -4136,71 +4073,71 @@ "diff_onesided", true, "fixed", [false; false; false; false; false; true]); - f = @ (p) ... + f = @ (p) sumsq (( ... subsasgn (x, struct ("type", "()", "subs", {{9, 3}}), p(5)) ... * horzcat (p([1, 2, 3]), p([3, 1, 2]), p([3, 2, 1])) ... - - p(6) * subsasgn (misc, struct ("type", "()", "subs", {{3, 2}}), p(4)); + - p(6) ... + * subsasgn (misc, struct ("type", "()", "subs", {{3, 2}}), p(4)))(:)); - p = nonlin_residmin (f, pin, settings); + p = nonlin_min (f, pin, settings); - assert (p, [1.0590; 1.9266; 4.0456; 2.7061; .3; 1], .0001); -4 tests, 4 passed, 0 known failure, 0 skipped -[inst/vfzero.m] ->>>>> /build/reproducible-path/octave-optim-1.6.2/inst/vfzero.m -***** shared opt0 - opt0 = optimset ("tolx", 0); -***** assert(vfzero(@cos, [0, 3], opt0), pi/2, 10*eps) -***** assert(vfzero(@(x) x^(1/3) - 1e-8, [0,1], opt0), 1e-24, 1e-22*eps) -2 tests, 2 passed, 0 known failure, 0 skipped -[inst/__all_stat_opts__.m] ->>>>> /build/reproducible-path/octave-optim-1.6.2/inst/__all_stat_opts__.m -***** assert (1) -1 test, 1 passed, 0 known failure, 0 skipped -[inst/linprog.m] ->>>>> /build/reproducible-path/octave-optim-1.6.2/inst/linprog.m + assert (p, [1.0590; 1.9266; 4.0456; 2.7061; .3; 1], .005); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/lsqlin.m] +>>>>> /build/reproducible-path/octave-optim-1.6.2/inst/lsqlin.m ***** test - f = [1; -1]; - A = []; - b = []; - Aeq = [1, 0]; - beq = [2]; - lb = [0; Inf]; - ub = [-Inf; 0]; - x_exp = [2; 0]; - assert (linprog (f, A, b, Aeq, beq, lb, ub), x_exp); -***** shared f, A, b, lb, ub, x_exp, fval_exp - f = [21 25 31 34 23 19 32 36 27 25 19]'; - - A1 = [ 1 0 0 0 1 0 0 1 0 0 0; - 0 1 0 0 0 1 0 0 1 0 0; - 0 0 1 0 0 0 0 0 0 1 0; - 0 0 0 1 0 0 1 0 0 0 1]; - A2 = [ 1 1 1 1 0 0 0 0 0 0 0; - 0 0 0 0 1 1 1 0 0 0 0; - 0 0 0 0 0 0 0 1 1 1 1]; - A = [-A1; A2]; - - b1 = [40; 50; 50; 70]; - b2 = [100; 60; 50]; - b = [-b1; b2]; - - lb = zeros (rows (f), 1); - ub = Inf (rows (f), 1); - - x_exp = [40 0 50 10 0 50 10 0 0 0 50]'; - fval_exp = f' * x_exp; - +***** shared C,d,A,b + C = [0.9501,0.7620,0.6153,0.4057;... + 0.2311,0.4564,0.7919,0.9354;... + 0.6068,0.0185,0.9218,0.9169;... + 0.4859,0.8214,0.7382,0.4102;... + 0.8912,0.4447,0.1762,0.8936]; + d = [0.0578; 0.3528; 0.8131; 0.0098; 0.1388]; + A =[0.2027, 0.2721, 0.7467, 0.4659;... + 0.1987, 0.1988, 0.4450, 0.4186;... + 0.6037 , 0.0152, 0.9318, 0.8462]; + b =[0.5251;0.2026;0.6721]; + Aeq = [3, 5, 7, 9]; + beq = 4; + lb = -0.1*ones(4,1); + ub = 2*ones(4,1); + [x,resnorm,residual,exitflag] = lsqlin(C,d,A,b,Aeq,beq,lb,ub); + assert(x,[-0.10000; -0.10000; 0.15991; 0.40896],10e-5) + assert(resnorm,0.16951,10e-5) + assert(residual, [0.035297; 0.087623; -0.353251; 0.145270; 0.121232],10e-5) + assert(exitflag,1) ***** test Aeq = []; beq = []; - [x_obs fval_obs] = linprog (f, A, b, Aeq, beq, lb, ub); - assert ([x_obs; fval_obs], [x_exp; fval_exp]); - -***** test - Aeq = zeros (1, rows (f)); - beq = 0; - assert (linprog (f, A, b, Aeq, beq, lb, ub), x_exp); -3 tests, 3 passed, 0 known failure, 0 skipped + lb = []; + ub = []; + x0 = 0.1*ones(4,1); + x = lsqlin(C,d,A,b,Aeq,beq,lb,ub,x0); + [x,resnorm,residual,exitflag] = lsqlin(C,d,A,b,Aeq,beq,lb,ub,x0); + assert(x,[ 0.12986; -0.57569 ; 0.42510; 0.24384],10e-5) + assert(resnorm,0.017585,10e-5) + assert(residual, [-0.0126033; -0.0208040; -0.1295084; -0.0057389; 0.01372462],10e-5) + assert(exitflag,1) +***** demo + C = [0.9501 0.7620 0.6153 0.4057 + 0.2311 0.4564 0.7919 0.9354 + 0.6068 0.0185 0.9218 0.9169 + 0.4859 0.8214 0.7382 0.4102 + 0.8912 0.4447 0.1762 0.8936]; + d = [0.0578; 0.3528; 0.8131; 0.0098; 0.1388]; + %% Linear Inequality Constraints + A =[0.2027 0.2721 0.7467 0.4659 + 0.1987 0.1988 0.4450 0.4186 + 0.6037 0.0152 0.9318 0.8462]; + b =[0.5251; 0.2026; 0.6721]; + %% Linear Equality Constraints + Aeq = [3 5 7 9]; + beq = 4; + %% Bound constraints + lb = -0.1*ones(4,1); + ub = ones(4,1); + [x, resnorm, residual, flag, output, lambda] = lsqlin (C, d, A, b, Aeq, beq, lb, ub) +2 tests, 2 passed, 0 known failure, 0 skipped [inst/polyconf.m] >>>>> /build/reproducible-path/octave-optim-1.6.2/inst/polyconf.m ***** test @@ -4213,28 +4150,6 @@ [y,dy] = polyconf(p,40,s,0.05,'pi'); assert(dy,4.45345484470743,200*eps); 1 test, 1 passed, 0 known failure, 0 skipped -[inst/jacobs.m] ->>>>> /build/reproducible-path/octave-optim-1.6.2/inst/jacobs.m -***** assert (jacobs (1, @(x) x), 1) -***** assert (jacobs (6, @(x) x^2), 12) -***** assert (jacobs ([1; 1], @(x) [x(1)^2; x(1)*x(2)]), [2, 0; 1, 1]) -***** assert (jacobs ([1; 2], @(x) [x(1)^2 + x(2); x(2)*exp(x(1))]), [2, 1; 2*exp(1), exp(1)]) -***** error jacobs () -***** error jacobs (1) -***** error jacobs (1, 2, 3, 4) -***** error jacobs (@sin, 1, [1, 1]) -***** error jacobs (@sin, 1, ones(2, 2)) -***** demo - # Relative error against several h-values - k = 3:20; h = 10 .^ (-k); x = 0.3*pi; - err = zeros (1, numel (k)); - for count = 1 : numel (k) - err(count) = abs (jacobs (x, @sin, struct ("h", h(count))) - cos (x)) / abs (cos (x)) + eps; - endfor - loglog (h, err); grid minor; - xlabel ("h"); ylabel ("|Df(x) - cos(x)| / |cos(x)|") - title ("f(x)=sin(x), f'(x)=cos(x) at x = 0.3pi") -9 tests, 9 passed, 0 known failure, 0 skipped [inst/quadprog.m] >>>>> /build/reproducible-path/octave-optim-1.6.2/inst/quadprog.m ***** test @@ -4285,6 +4200,27 @@ f = -C' * d; [x, obj, flag, output, lambda]=quadprog (H, f, A, b, Aeq, beq, lb, ub) 1 test, 1 passed, 0 known failure, 0 skipped +[inst/statget.m] +>>>>> /build/reproducible-path/octave-optim-1.6.2/inst/statget.m +***** shared opts + opts = statset ("maxit", 100); +***** assert (statget (opts, "maxit"), 100) +***** assert (statget (opts, "MaxITer"), 100) +***** assert (statget (opts, "TolFun"), []) +***** assert (statget (opts, "TolFun", 1e-3), 1e-3) +***** error statget () +***** error statget (1) +***** error statget (1,2,3,4,5) +***** error statget (1, "name") +***** error statget (struct (), 2) +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/vfzero.m] +>>>>> /build/reproducible-path/octave-optim-1.6.2/inst/vfzero.m +***** shared opt0 + opt0 = optimset ("tolx", 0); +***** assert(vfzero(@cos, [0, 3], opt0), pi/2, 10*eps) +***** assert(vfzero(@(x) x^(1/3) - 1e-8, [0,1], opt0), 1e-24, 1e-22*eps) +2 tests, 2 passed, 0 known failure, 0 skipped [inst/nonlin_curvefit.m] >>>>> /build/reproducible-path/octave-optim-1.6.2/inst/nonlin_curvefit.m ***** demo @@ -4309,6 +4245,106 @@ cp = nonlin_curvefit (@ (p, x) t.f (x, p), t.init_p, t.data.x, t.data.y, optimset ("lbound", t.non_strict_inequc.bounds(:, 1), "ubound", t.non_strict_inequc.bounds(:, 2), "inequc", {t.non_strict_inequc.general}, "dfdp", @ (p, x) t.dfdp (x, p))); assert (cp, t.result.p, [.0001; .001]); 1 test, 1 passed, 0 known failure, 0 skipped +[inst/jacobs.m] +>>>>> /build/reproducible-path/octave-optim-1.6.2/inst/jacobs.m +***** assert (jacobs (1, @(x) x), 1) +***** assert (jacobs (6, @(x) x^2), 12) +***** assert (jacobs ([1; 1], @(x) [x(1)^2; x(1)*x(2)]), [2, 0; 1, 1]) +***** assert (jacobs ([1; 2], @(x) [x(1)^2 + x(2); x(2)*exp(x(1))]), [2, 1; 2*exp(1), exp(1)]) +***** error jacobs () +***** error jacobs (1) +***** error jacobs (1, 2, 3, 4) +***** error jacobs (@sin, 1, [1, 1]) +***** error jacobs (@sin, 1, ones(2, 2)) +***** demo + # Relative error against several h-values + k = 3:20; h = 10 .^ (-k); x = 0.3*pi; + err = zeros (1, numel (k)); + for count = 1 : numel (k) + err(count) = abs (jacobs (x, @sin, struct ("h", h(count))) - cos (x)) / abs (cos (x)) + eps; + endfor + loglog (h, err); grid minor; + xlabel ("h"); ylabel ("|Df(x) - cos(x)| / |cos(x)|") + title ("f(x)=sin(x), f'(x)=cos(x) at x = 0.3pi") +9 tests, 9 passed, 0 known failure, 0 skipped +[inst/linprog.m] +>>>>> /build/reproducible-path/octave-optim-1.6.2/inst/linprog.m +***** test + f = [1; -1]; + A = []; + b = []; + Aeq = [1, 0]; + beq = [2]; + lb = [0; Inf]; + ub = [-Inf; 0]; + x_exp = [2; 0]; + assert (linprog (f, A, b, Aeq, beq, lb, ub), x_exp); +***** shared f, A, b, lb, ub, x_exp, fval_exp + f = [21 25 31 34 23 19 32 36 27 25 19]'; + + A1 = [ 1 0 0 0 1 0 0 1 0 0 0; + 0 1 0 0 0 1 0 0 1 0 0; + 0 0 1 0 0 0 0 0 0 1 0; + 0 0 0 1 0 0 1 0 0 0 1]; + A2 = [ 1 1 1 1 0 0 0 0 0 0 0; + 0 0 0 0 1 1 1 0 0 0 0; + 0 0 0 0 0 0 0 1 1 1 1]; + A = [-A1; A2]; + + b1 = [40; 50; 50; 70]; + b2 = [100; 60; 50]; + b = [-b1; b2]; + + lb = zeros (rows (f), 1); + ub = Inf (rows (f), 1); + + x_exp = [40 0 50 10 0 50 10 0 0 0 50]'; + fval_exp = f' * x_exp; + +***** test + Aeq = []; + beq = []; + [x_obs fval_obs] = linprog (f, A, b, Aeq, beq, lb, ub); + assert ([x_obs; fval_obs], [x_exp; fval_exp]); + +***** test + Aeq = zeros (1, rows (f)); + beq = 0; + assert (linprog (f, A, b, Aeq, beq, lb, ub), x_exp); +3 tests, 3 passed, 0 known failure, 0 skipped +[inst/nlinfit.m] +>>>>> /build/reproducible-path/octave-optim-1.6.2/inst/nlinfit.m +***** test + modelfun = @(b, x) (b(1) + b(2) * exp (- b(3) * x)); + b = [1;3;2]; + v = rande ("state"); + rande ("seed", 1234); + xdata = exprnd (2,100,1); + rande ("state", v); + v = randn ("state"); + randn ("seed", 1234); + ydata = modelfun (b,xdata) + normrnd (0,0.1,100,1); + randn ("state", v); + beta0 = [2;2;3]; + beta = nlinfit(xdata,ydata,modelfun,beta0); + assert (beta, [1;3;2], 1e-1) +***** demo + modelfun = @(b, x) (b(1) + b(2) * exp (- b(3) * x)); + %% actual value + beta_without_noise = [1; 3; 2]; + x = [3.49622; 0.33751; 1.25675; 3.66981; 0.26237; 5.51095; ... + 2.11407; 1.48774; 6.22436; 2.04519]; + y_actual = modelfun (beta_without_noise, x); + noise = [0.176110; -0.066850; 0.231000; -0.047570; -0.108230; ... + 0.122790; 0.062940; 0.151510; 0.116010; -0.097460]; + y_noisy = y_actual + noise; + %% initial guess + beta0 = [2; 2; 2]; + %% weights vector + weights = [5; 16; 1; 20; 12; 11; 17; 8; 11; 13]; + [beta, R, J, covb, mse] = nlinfit (x, y_noisy, modelfun, beta0) + [beta_w, R_w, J_w, covb_w, mse_w] = nlinfit (x, y_noisy, modelfun, beta0, [], "weights", weights) +1 test, 1 passed, 0 known failure, 0 skipped Checking C++ files ... Done running the unit tests. Summary: 57 tests, 57 passed, 0 known failures, 0 skipped @@ -4344,12 +4380,14 @@ dpkg-buildpackage: info: binary-only upload (no source included) dpkg-genchanges: info: not including original source code in upload I: copying local configuration +I: user script /srv/workspace/pbuilder/933139/tmp/hooks/B01_cleanup starting +I: user script /srv/workspace/pbuilder/933139/tmp/hooks/B01_cleanup finished I: unmounting dev/ptmx filesystem I: unmounting dev/pts filesystem I: unmounting dev/shm filesystem I: unmounting proc filesystem I: unmounting sys filesystem I: cleaning the build env -I: removing directory /srv/workspace/pbuilder/3250465 and its subdirectories -I: Current time: Mon Jun 9 10:09:53 -12 2025 -I: pbuilder-time-stamp: 1749506993 +I: removing directory /srv/workspace/pbuilder/933139 and its subdirectories +I: Current time: Wed May 8 06:04:18 +14 2024 +I: pbuilder-time-stamp: 1715097858